简体   繁体   中英

Execute TestNG.xml from Jenkins (Maven Project)

  1. My Project dosnt have a bin folder
  2. Have tried the following:

D:>java -cp "Pathtolibfolder\\lib*;Pathtobinfolder\\bin" org.testng.TestNG testng.xml

Any Ideas?

If you are using Maven then i would simply use the surefire plugin and run tests as part of the build:

<plugins>

    ...

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>RELEASE</version>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>testng.xml</suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>

    ...

</plugins>

Just specify the path to your testng.xml and take advantage of it if you can use this kind of configuration. It allows for tons of parametrization and i have used it extensively in my projects.

Check out this tutorial to get a hang of it: http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM