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

Add existing java project to maven
How to use case when expression in hibernate
Dynamically generating Spring Data Repositories
How to detect if motion event gesture is performed on the left or right side of the screen?
Encountered error while trying JCov java coverage utility
JPanel won't show up in JFrame
Java rectangle of stars with for loop with separate print as String
IInAppBillingService not binding properly
Java Generics extends
Selecting second column (FileReader)
One object, multiple views
JavaFX Deployment on Mac - Build Error “failed to produce a bundle”
Modifying specific strings for different languages using different common modules (Android)
Spring : Singleton VS Prototype
SQL Error: 1795, SQLState: 42000 - maximum number of expressions in a list is 1000
Apache Util.copyStream: Stop Stream

Categories

HOME
java
google-chrome-extension
jdo
date
debugging
tizen
lodash
adb
spring-jdbc
alpha
ojdbc
cloudkit
offline
spring-tool-suite
jsprit
swingx
bootstrap-tour
cultureinfo
poltergeist
selectedindexchanged
chromebook
wpfdatagrid
traffic
fgetcsv
newline
librato
tinymce-4
galsim
stringtemplate
gammu
nssegmentedcontrol
devextreme
restlet
adobe-premiere
gesture
hue
streamreader
preconditions
avro4s
dynamic-reports
arena-simulation
modelmapper
flashair
slick-3.0
qwt
flickr-api
dotcover
atomicity
logparser
blogengine.net
typescript1.8
recursive-datastructures
forever
tactic
typed-lambda-calculus
epson
cudafy.net
google-web-starter-kit
xml-attribute
pagedlist
moveit
asp.net5
lemon
cyclomatic-complexity
wireshark-dissector
muse
emailrelay
cakephp-3.1
tableau-online
dereference
javax.mail
kineticjs
java-metro-framework
preferences
rdl
document-classification
openexr
jubula
doskey
marmalade
mechanize-ruby
resty-gwt
imdbpy
listings
ruby-datamapper
bulkloader
file-locking
excel-2003
gridcontrol
android-hardware
mt
bluepill
datawindow
dsn
chrono
nsmanagedobject
dotnethighcharts
disclosure
floating
web-application-design
xsdobjectgen
thunderbird-lightning
anti-piracy
multiple-languages
django-notification

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App