This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parameters({ "seleniumhost", "seleniumport", "browser"}) | |
@BeforeClass | |
public void setUp(@Optional("localhost") String seleniumhost, @Optional("4444") String seleniumport, @Optional(Selenium.FIREFOX) String browser){ | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<suite name="testsuite"> | |
<parameter name="seleniumhost" value="192.168.1.22"/> | |
<parameter name="seleniumport" value="4444"/> | |
<parameter name="browser" value="*iexplore"/> | |
<test name="Login"> | |
<classes> | |
<class name="usecases.Login" /> | |
</classes> | |
</test> | |
<test name="Logout"> | |
<classes> | |
<class name="usecases.Logout" /> | |
</classes> | |
</test> | |
</suite> |
"java org.testng.TestNG testng1.xml"
into your command prompt. For the execution of your tests by hudson, you’ll need to create a
new hudson job, build it once, then copy your tests into the established
directory of the job (you’ll find it at usr/.hudson/jobs ) and write a
ant file, which can be executed by hudson.An Ant file has different targets, which can or can’t be executed separatly, sequential. You can define them in the hudson job configuration. Your ant file could look like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<project basedir="." default="testsuite" name="Selenium"> | |
<property environment="env"/> | |
<property name="debuglevel" value="source,lines,vars"/> | |
<property name="target" value="1.6"/> | |
<path id="TestNG.libraryclasspath"> | |
<pathelement location="../../libs/testng-6.0.1.jar"/> | |
</path> | |
<path id="Selenium.classpath"> | |
<pathelement location="bin"/> | |
<path refid="TestNG.libraryclasspath"/> | |
<pathelement location="../../libs/selenium-java-client-driver.jar"/> | |
<pathelement path="${env.JAVA_HOME}\jre\lib\rt.jar"/> | |
</path> | |
... | |
<target depends="build" name="runTestsuite" description="Running testsuite"> | |
<echo>Running testsuite ... </echo> | |
<taskdef resource="testngtasks" classpathref="Selenium.classpath"/> | |
<testng outputDir="output/testsuite" haltonfailure="false" classpathref="Selenium.classpath"> | |
<xmlfileset dir="src" includes="testsuite.xml"/> | |
</testng> | |
</target> | |
</project> |
No comments:
Post a Comment