I am using Selenium and Java with Eclipse and TestNG.

Now I want to make a .jar file for running this test case on another system that doesn't have Selenium and Java.

How can this be done?

1 Answer 1


You can run TestNG programatically (more details here):

TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { Run2.class });

And together with the Eclipse Export Wizard, you can create an executable for it.

that don't have ... Java setup

But naturally you need a JRE to execute .jar

However, if you simply boot up a container with Selenium, you will be able to manage changes extremely more easily than with executable files. More details here.

  • Obviously you will need Docker installed to run contain er. What's the advantage over installing JRE?
    – dzieciou
    Aug 5, 2023 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.