Gbru
Gbru

Reputation: 1087

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?

Upvotes: 3

Views: 3696

Answers (1)

Maciej Kowalski
Maciej Kowalski

Reputation: 26492

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

Upvotes: 4

Related Questions