How to execute Testng project without main method

2019-03-05 23:21发布

I have a TestNG project where I use testng.xml file to execute. How to take a jar of my project and execute it on another machine. I know how to execute it on the same machine by giving path of bin & lib folders i.e

cd C:\Workspace\projectname java -cp C:\Workspace\projectname\lib*;C:\Workspace\projectname\bin org.testng.TestNG testng.xml.

But if i want to do on another machine how to do this?

1条回答
Animai°情兽
2楼-- · 2019-03-06 00:12

You can create a bash file which points to your testng.xml file.

Use this: Bash file is running fine in windows for testng but it is not working in linux/mac

Steps:-

 1. Create a notepad file
 2. Copy -> java -cp ./src/lib/*:./bin org.testng.TestNG testng.xml(use ; instead of : if you are using windows) (./src/lib/* -> All your jars files must present in this location, ./bin -> all your class files must be present here)
 3. save the file.
 4. Rename the file as something.bat
 5. Double click on file if you are using windows or use **bash filename** if using linux or mac

Note: - Java, require browsers must be present in other computer and it's a prerequisite which is nothing to do with your automation script run. they must be pre-installed

查看更多
登录 后发表回答