How to make an executable jar file of my Selenium framework

337 views
Skip to first unread message

musaffir

unread,
May 10, 2013, 7:44:32 AM5/10/13
to seleniu...@googlegroups.com, musaf...@accolite.com
Dear All,

I work on keyword driven selenium automation framework, where i have an excel file in which i defines the keywords
I have a TestExecutor Java class,which receives the keywords(from the excel file) with the help of Apache POI ,and based on the keyword various Selenese commands gets executed [For example Typing in to text field,clicking on a button,selecting a value from a drop down etc ]

For around 2 months I ran this framework from Eclipse it self as a Java application,.....
After that I exported a ANT Build.xml from eclipse for this framework and used to just invoke the Build.xml to run the framework[with out opening eclipse]...Since Build.xml is generated from the Eclipse it self , it taken care of all the dependent libraries path etc , like the selenium driver jars,Apache POI jars and all other dependents ones..

Now I don't want to follow this approach...I want to leave the Build.xml....I want to get an executable jar file and run the framework by the jar file... also this will help me to deliver the framework just by giving the executable jar file...


I am aware of making a jar file, but little apprehensive about when i run this jar file ,will there be problem saying "package or some thing doesnt exist "
Can any of you please tell me how can i make one such jar file which should have references to all the dependent libraries and packages (like selenium server jar ,apache poi etc )...and when i execute the jar file it should work by considering the keywords given in the excel...

Please let me know if you have any input...

Thank You so much in Advance ..
Musaffir



Gustavo Godoy

unread,
May 10, 2013, 9:25:34 AM5/10/13
to seleniu...@googlegroups.com, musaf...@accolite.com
Hi Musafir,

I think that approach to make a jar and in manifest declare all your dependencies and then run your jar is not a good approach.
Your problem is just the classpath of your executable tests. If you define this by ANT, you can run your build.xml like eclipse does.
I really appreciate the maven concepts, only declare what I want and maven takes care of all.

If your jar for tests is really necessary to make this jar, just create your jar and define your path to your libs (like ./lib) and put the same jars you have in the eclipse java build path).
Obviously if you use ant to compile your jar, just declare the classpath to manifests jar compilation. But doing this is the same to define the classpath for tests...(thats why I think a test jar is not a good approach).

Thanks

Gustavo Godoy
Reply all
Reply to author
Forward
0 new messages