同时我想为 Test.xml 创建任务调度程序。 xml文件包含三个java文件,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="TestAll">
<test name="test1">
<classes>
<class name="test.LoginOneReports" />
</classes>
</test>
<test name="test2">
<classes>
<class name="test.OEPR_DefaultTab" />
</classes>
</test>
<test name="test3">
<classes>
<class name="test.OEPR_InternalvsExternalTab" />
</classes>
</test>
</suite>
我创建了一个 run.bat ,如下所示:
@echo off
set ProjectPath=C:\Documents and Settings\amth\workspace\OneReports\src\
echo %ProjectPath%
set PATH=%ProjectPath%bin;%ProjectPath%lib*
set path=%PATH%%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files (x86)\Java\jdk1.7.0_51\bin;
echo %PATH%
pause
echo java org.testng.TestNG %ProjectPath%Test.xml
答案 0 :(得分:2)
从命令行逐个运行以下命令
cd C:\Documents and Settings\amth\workspace\OneReports\src\test
javac LoginOneReports.java
java -cp . LoginOneReports
您应该学习如何从命令行运行java程序的文档
http://docs.oracle.com/javase/tutorial/getStarted/cupojava/win32.html
http://www.sergiy.ca/how-to-compile-and-launch-java-code-from-command-line/