java


Running a java script with a java program


I have a selenium script written in java with the following structure
Script.java
#before
-----Some methods------
#Test
-----Some methods------
#after
-----Some methods------
and i have a main java program with structure
Main.java
public static void main(String args[]) throws IOException {
//Here i have to write the logic to run the above script
}
in which i have a main method i have to run the above mentioned script from this java program, how it can be done. as i am a newbie for java so any suggestions are welcome.
If you are using unit test framework like JUnit or TestNg Then the methods mentioned under annotations like #Test ,#Before and so on are independent itself. Their execution order is as per preferance in that framework itself. Main method not required here.
So in your case if you have done code using these methods using any TestNG or JUnit then have to use like following -
class Myclass
{
#Before
public void methodA()
{
// Your code
}
#Test
public void methodB()
{
// your code
}
#After
public void methodC
{
// your code
}
}
And Run your class like Run As > TestNG Test if you are using TestNG framework

Related Links

Running Java program by a Java program [closed]
duplicated blocks are not detected from Sonar Eclipse Plugin
Converting Cursor into generic object android
Whats wrong with my delete method in LinkedList (generic)?
What is the simplest way to run method asynchronously and being able to see its state?
Why does Java have both CountDownLatch and CyclicBarrier?
Converting String[] to String[][] in java
High Latency between Hazelcast members (using Topic publish/onMessage)
how to store integer with 38 digit in mongo db through java driver
Reverse name task
Azure giving subscription level resource group access to application
Is this semaphore implementation faulty?
Space after clearing TextField in JavaFx
how to get image size in java
smtp.gmail.com, port: 587 fails
DBUNIT flatXmlDataSet file and columns with special characters

Categories

HOME
openlayers
cloud
isabelle
dictionary
sqlite-net-extensions
elm
sqlite3
retrofit
pivotal-cloud-foundry
azure-storage-tables
qore
pheatmap
virtualization
session-variables
vifm
nstableview
collectd
google-cloud-spanner
spring-tool-suite
dtrace
systemc
openedx
nas
cx-freeze
trading
rundeck
android-widget
microsoft-sync-framework
facebook-access-token
react-css-modules
web-api-testing
publish
ping
saas
subdomains
phonegap
galsim
data-manipulation
code-contracts
lxd
subset-sum
mpmediaquery
environment-modules
picasso
overlap
neuroscience
mixture-model
occlusion
impersonation
hue
trim
elmah
sas-jmp
executenonquery
skeleton-css-boilerplate
smartcontracts
python-c-api
paxos
celery-task
statsd
elgg
np-complete
spring-mongodb
account-kit
google-cdn
watchconnectivity
ableton-live
url-pattern
static-ip-address
sts-springsourcetoolsuite
mathematica-frontend
mongocsharpdriver
plottable.js
storekit
kendonumerictextbox
pervasive-sql
cartesian-product
icu4j
mutation-observers
atk4
wordml
android-listview
map-projections
ideamart
streambase
pick
gadt
android-nested-fragment
xojo
eol
android-2.2-froyo
transcoding
centos5
ccss
yui-compressor
mqx
ember-app-kit
rdoc
broken-links
newtonscript
amazon-appstore
nsdatecomponents
subgurim-maps
tomcat-valve
jquery-ui-droppable
asp.net-profiles
multi-tier
sef
microsoft-virtualization
defensive-programming
zune
genealogy
ugc
paul-graham
ajax-forms

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App