0

I am using Junit4 for my web driver framework. I run all my test using test suite. Can someone Please help me to create executable file for test suite so that manual testers can run it at their end. I have not used main function.All my tests are written in junit that has been merged into a test suite.

Yash Varshney
  • 365
  • 1
  • 5
  • 16
  • 1
    Check this link if it can help you to make a jar file. [http://stackoverflow.com/questions/13410242/making-jar-file-of-a-test-project-in-selenium-web-driver](http://stackoverflow.com/questions/13410242/making-jar-file-of-a-test-project-in-selenium-web-driver) – HemChe Oct 24 '13 at 09:21

1 Answers1

0

You need to create a main function. Maybe some classes with main function for each different execution. If you are using Eclipse IDE:

1st- Right click on project > Run As... > Run configuration... > Java Aplication > New

Then create your configuration.

2nd- Right click on project > Export... > Runnable JAR File

Choose configuration and destination.

To run your .jar file: java -jar yourJar.jar

If you need parameters on your main class:

public static void main(String[] arg)

Use like this arg[0], arg[1], ...

Hope it helps.

Héctor Flores
  • 253
  • 2
  • 9
  • Can you please let me know how to call setup method of test class from main function – Yash Varshney Nov 12 '13 at 09:33
  • If you have some testNG suites (xml files) you need (for example) to call them from your main class. TestNG testng = new TestNG(); List suites = new ArrayList(); suites.add("testSuites/xxxx.xml"); testng.setTestSuites(suites); testng.run(); Hope it helps. – Héctor Flores Nov 12 '13 at 11:06
  • Sorry. I don't know why I thought you were using TesNG... I don't work with JUnit, but I think you can use something like this: http://www.tutorialspoint.com/junit/junit_suite_test.htm – Héctor Flores Nov 13 '13 at 18:33