TesNG
TestNG is a testing framework designed to simplify a wide range of test requirements, from unit testing (separated
From testing a class) to integration testing (testing is composed of multiple classes, multiple packages, or even multiple external frameworks ).
Systems, such as servers ).
TestNG is a testing framework designed to simplify a wide range of test requirements, from unit testing
Integration Test
This is the starting point of the TestNG design. It is not only a unit test, but also an integrated test.
Run the batch file
@ Echo off
Rem test. bat src \ testng. xml https: \// 192.168.0.156
Setlocal DisableDelayedExpansion
If "% 1%" = ""(
Set TESTSUIT = src \ testng. xml
) Else (
Set TESTSUIT = % 1%
)
If not "% 2%" = ""(
Attrib-R src \ testng. xml
Rem
Type % TESTSUIT % | C: \ test \ UnxUtils \ usr \ local \ wbin \ sed.exe-e "s/http: \ // localhost \/test.htm/% 2%/g "> test. xml
Rem copy/Y test. xml % TESTSUIT %
) Else (
Copy/Y % TESTSUIT % test. xml
)
Endlocal
Rem ==========================================
Setlocal EnableDelayedExpansion
Set JAVA_HOME = % JAVA_HOME %
Rem set PATH = % PATH; % JAVA_HOME % \ bin
Set CLASSPATH =./bin;
Set LIBS =
Pushd libs
For/f "delims =" % s in ('dir/B ') do (
Rem echo % s
Set LIBS =! LIBS !;. /Libs/
Set LIBS =! LIBS! % S;
)
Popd
Rem echo % LIBS %
Set CLASSPATH =./bin/; % LIBS %
Rem echo % CLASSPATH %
Rem pause
Java-classpath % CLASSPATH % org. testng. TestNG test. xml
Endlocal
Testng
<? Xml version = '1. 0' encoding = 'utf-8'?>
<Suite name = "Parallel Tests" verbose = "1" thread-count = "4"
Parallel = "tests">
<Tests>
<Test name = "Windows + IE8 Test">
<Parameters>
<Parameter name = "platform" value = "Windows"/>
<Parameter name = "browser" value = "Internet Explorer"/>
<Parameter name = "version" value = "8"/>
<Parameter name = "url" value = "http: // localhost/test.htm"/>
</Parameters>
<Classes>
<Class name = "logon"/>
</Classes>
</Test>
<Test name = "Windows + Firefox4 Test">
<Parameters>
<Parameter name = "platform" value = "Windows"/>
<Parameter name = "browser" value = "Firefox"/>
<Parameter name = "version" value = "4"/>
<Parameter name = "url" value = "http: // localhost/test.htm"/>
</Parameters>
<Classes>
<Class name = "logon"/>
</Classes>
</Test>
<Test name = "Windows + Chrome Test">
<Parameters>
<Parameter name = "platform" value = "Windows"/>
<Parameter name = "browser" value = "chrome"/>
<Parameter name = "version" value = "31"/>
<Parameter name = "url" value = "http: // localhost/test.htm"/>
</Parameters>
<Classes>
<Class name = "logon"/>
</Classes>
</Test>
</Tests>
</Suite>