프로젝트를 모듈로 나누면 각 모듈마다 실행할 테스트 클래스가있는 단일 XML 제품군이 있습니다. 다른 환경에서 변수 -Denv=ENV_ALIAS
을 전달하여 maven 명령으로 테스트를 실행하고 System.getProperty("env")
으로 처리합니다.Maven -D 매개 변수 (그룹?)를 사용하여 TestNG 테스트 컨트롤
다른 국가 버전의 응용 프로그램을 처리하기 위해 솔루션을 재조정했습니다. 다른 버전에서는 일부 기능이 비활성화되었거나 일부 흐름이 다릅니다. 테스트에서 다른 URL을 사용하지만 모든 테스트가 기본적으로 실행되도록 변수 -DcountryCode=COUNTRY_ALIAS
을 전달합니다.
각 테스트 방법에서 스위칭 메커니즘을 구현하는 대신 스위트 수준에서 countryCode
값에 따라 일부 테스트를 비활성화하고 싶습니다. 그룹을 기본 testNG 솔루션으로 생각했지만 스위트 파일 내에서 하드 코드해야하므로 정적 인 경우가 많습니다. 더 역동적으로 만들 수있는 방법이 있습니까? 또는 각 국가별로 전용 모듈을 만들 수 있지만 TestNG가 하나의 적절한 제품군을 실행하도록 지시해야합니다 (어떻게해야합니까?).
처리하는 가장 좋은 방법은 무엇입니까? 그것을 처리하는 더 좋은 방법이 있습니까?
내 부모 치어 가장 중요한 부분 :
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.autoqa</groupId>
<artifactId>autoqa-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>autoqa-parent</name>
<modules>
<module>autoqa-common</module>
<module>autoqa-newcrm</module>
<module>autoqa-website</module>
<module>autoqa-giftshop</module>
<module>autoqa-unlimited</module>
<module>autoqa-booking</module>
</modules>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefireVersion}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${surefireVersion}</version>
</dependency>
</dependencies>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/${file.name}.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<browserName>${browserName}</browserName>
<suiteName>${suiteName}</suiteName>
<countryCode>${countryCode}</countryCode>
<env>${env}</env>
</systemPropertyVariables>
<properties>
<property>
<name>surefire.testng.verbose</name>
<value>10</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
위대한 답변! 도와 줘서 고마워. 각 나라마다 어떤 클래스가 실행되는지에 대한 명확한 견해를 가지기 위해 별도의 스위트 룸을 만들었지 만, 그룹 솔루션은 내가 필요한 것입니다. – Piotroslav