-1

测试结果

跑步者班

<dependency>
        <groupId>io.github.prashant-ramcharan</groupId>
        <artifactId>courgette-jvm</artifactId>
        <version>6.3.0</version>
    </dependency>
    <!--CUCUMBER DEPENDENCIES -->
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.1.0</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java8</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
<dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven.surfire.plugin.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven.surfire.plugin.version}</version>
    </dependency>

我没有关于错误原因的信息。我在 pom.xml 中添加了 courgette 依赖项。什么可能导致问题?

4

1 回答 1

0

您的 Maven 目标似乎有些问题test。您可以利用我用来运行courgette-jvmtestNG测试的以下配置。它使用failsafe插件和一个profile名为acceptanceTests. 所有配置都在此配置文件中。我用来运行它的命令是mvn clean verify -P acceptanceTests -XintelliJ

  </dependency>
          <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.14.3</version>
        <scope>test</scope>
    </dependency>
          <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>6.9.1</version>
    </dependency>
          <dependency>
        <groupId>io.github.prashant-ramcharan</groupId>
        <artifactId>courgette-jvm</artifactId>
        <version>5.11.0</version>
    </dependency>
      <dependency>
  <!-- httpclient dpendendecy is to resolve courgette-jvm error -  NoClassDefFoundError: org/apache/http/conn/ssl/TrustAllStrategy -->        
 <groupId>org.apache.httpcomponents</groupId>
    <artifactId>httpclient</artifactId>
    <version>4.5.10</version>
</dependency>

 <profiles>
<profile>
      <id>acceptanceTests</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>

        <plugins>
             <plugin>
                    <groupId>org.codehaus.mojo</groupId> 
                    <artifactId>properties-maven-plugin</artifactId> 
                    <version>1.0.0</version> 
                    <executions> 
                        <execution> 
                            <phase>generate-resources</phase> 
                            <goals> 
                                <goal>write-project-properties</goal> 
                            </goals> 
                            <configuration> 
                                <outputFile>${project.build.outputDirectory}/my.properties</outputFile> 
                            </configuration> 
                        </execution> 
                    </executions> 
             </plugin>

 <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M5</version>
            <executions>
                 <execution>
                  <id>integration-test</id> 
                <goals>
                  <goal>integration-test</goal>
                  
                </goals>
                     <configuration>
                        <parallel>methods</parallel>
                         <threadCount>4</threadCount>
                        <useUnlimitedThreads>true</useUnlimitedThreads>
                           <systemPropertyVariables>
                                <hub.port>${hub.p}</hub.port>
                                 
                          </systemPropertyVariables>
                      </configuration>
              </execution>
         
            </executions>
   
          </plugin>
           <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>8</source>
          <target>8</target>
        </configuration>
             
      </plugin>
           
              <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>failsafe-report-only</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
  </plugins>
  
  </build>

</profile>
 </profiles>

Runner类是

@Test
@CourgetteOptions(
        threads = 10,
        runLevel = CourgetteRunLevel.SCENARIO,
        rerunFailedScenarios = true,
        rerunAttempts = 1,
        showTestOutput = true,
        reportTitle = "Courgette-JVM Example",
        reportTargetDir = "build",
        environmentInfo = "browser=chrome; git_branch=master",
        cucumberOptions = @CucumberOptions(
                features = "src/test/resources/com/test/",
                
                glue = "com.test.stepdefs",                  
                tags = {"@firefox or @chrome"},                                     
                publish = true,
                plugin = {
                        "pretty",
                        "json:target/cucumber-report/cucumber.json",
                        "html:target/cucumber-report/cucumber.html"}
        ))
class AcceptanceIT extends TestNGCourgette {
}
于 2022-02-24T23:18:22.260 回答