Как запускать разные testng xml в Jenkins?

Добрый вечер!
Использую связку Java + Webdriver + TestNG + Maven + Jenkins. Хочу создать 2 тест сета - 1й будет смоук(быстрый, после каждого коммита) и 2й регрессия (найтли, который будет выполняться около часа). Каким образом это лучше сконфигурировать? Создать 2 разных test.xml и как-то настроить 2 джобы дженкинса на них? Или же копать в сторону мавена и профайлов?

В этом деле новичек, буду признателен за любые советы, ссылки или напутствия

Я бы предложил следующий флоу:

  • В Jenkins создать choice parameter со списком suites для запуска.
  • Через проперти и мейвен профайл вычитать значение выбранного suite.
  • Передать значение в maven-surefire-plugin.
3 лайка

@ArtOfLife, это как-то так в pom.xml выглядит?

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <env.config>local</env.config>
    <browser>chrome</browser>
    <threads>2</threads>
    ...
    <suiteFile>testng.xml</suiteFile>
    передаваемые значение в "maven-surefire-plugin"
  </properties>

  <profiles>
    <profile>
      <id>PROFILE_1</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
            <version>${maven-compiler-plugin.version}</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.7.2</version>
            <configuration>
              <parallel>methods</parallel>
              <threadCount>${threads}</threadCount>
              <systemProperties>
                <env.config>${env.config}</env.config>
                <browser>${browser}</browser>
              </systemProperties>
              <testFailureIgnore>true</testFailureIgnore>
              <suiteXmlFiles>
                <suiteXmlFile>${suiteFile}</suiteXmlFile>
              </suiteXmlFiles>
              <reportsDirectory>TestReport</reportsDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

Спасибо…

<properties>
    <suites>${env.SUITES}</suites>
</properties>

<profiles>
    <profile>
        <id>suite-absent</id>
        <activation>
            <property>
                <name>!env.SUITES</name>
            </property>
        </activation>
        <properties>
            <suites>default.suite.name</suites>
        </properties>
    </profiles>
</profiles>

...

<suiteXmlFiles>
    <suiteXmlFile>src/test/resources/suites/${suites}.xml</suiteXmlFile>
</suiteXmlFiles>

Где SUITES - переменная окружения, заданная на уровне Jenkins.

1 лайк