重新运行黄瓜中失败的方案时出错

如何解决重新运行黄瓜中失败的方案时出错

我试图在黄瓜中重新运行失败的场景,为此我设计了两个运行程序文件,一个是实际的运行程序文件,其中包含功能文件的路径以及指定了rerun.txt文件路径的rerun插件。运行程序文件,具有要运行的功能的重新运行文件的路径,因此在为失败的方案运行两个运行程序文件后,我都会收到此错误:-

WARNING: No features found at file:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/Reports/rerun.txt

请帮助我解决此错误,并自动运行rerun.txt文件的失败方案。

实际的跑步类文件如下:-

package com.framework.runners;

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.Test;

@CucumberOptions(features = "src/test/java/com/framework/features",glue = {"com/framework/utils","com/framework/stepDef"},tags = "@run",plugin = {
                "pretty","json:target/Reports/JsonReport/report.json","junit:target/Reports/Junitreports/report.xml","html:target/Reports/HTMLReport","rerun:target/Reports/rerun.txt"
        },monochrome=true)

@Test
public class TestRunner extends AbstractTestNGCucumberTests {
}

重新运行器类文件如下:-

package com.framework.runners;

import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
import org.testng.annotations.Test;

@CucumberOptions(features = "target/Reports/rerun.txt","json:target/FailedReports/JsonReport/report.json","junit:target/FailedReports/Junitreports/report.xml","html:target/FailedReports/HTMLReport"},monochrome=true)

@Test
public class ReRunTestRunner extends AbstractTestNGCucumberTests {
}

pom.xml配置为:-

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         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>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <groupId>org.example</groupId>
    <artifactId>com.CucumberHybrid</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.13.3</version>
        </dependency>
        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>3.8.1</version>
        </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-java</artifactId>
            <version>6.1.2</version>
        </dependency>
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>5.3.0</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>6.1.2</version>
        </dependency>
        <dependency>
            <groupId>com.github.mkolisnyk</groupId>
            <artifactId>cucumber-runner</artifactId>
            <version>1.3.5</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>net.masterthought</groupId>
                <artifactId>maven-cucumber-reporting</artifactId>
                <version>3.16.0</version>
                <executions>
                    <execution>
                        <id>execution</id>
                        <phase>test</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <projectName>Cucumber Framework Execution Report</projectName>
                            <outputDirectory>${project.build.directory}/Reports/cucumber-reports</outputDirectory>
                            <cucumberOutput>${project.build.directory}/Reports/JsonReport/report.json</cucumberOutput>
                            <buildNumber>42</buildNumber>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <executions>
                    <execution>
                        <id>testngtest</id>
                        <phase>test</phase>
                    </execution>
                </executions>
                <configuration>
                    <!-- <systemPropertyVariables> <IsGridSetup>${is.grid}</IsGridSetup>
                        <HubUrl>${hub.url}</HubUrl> <FeatureName>${feature.name}</FeatureName> <TagName>${tag.name}</TagName>
                        <BrowserType>${browser.type}</BrowserType> </systemPropertyVariables> -->
                    <forkCount>3</forkCount> <!-- how many parallel vm get created and execute -->
                    <reuseForks>false</reuseForks><!-- Every it will create a new vm for
                        the execution and will not use any existing -->
                    <testFailureIgnore>true</testFailureIgnore><!-- The execution will continue
                        even if there is a test failure -->
                    <includes> <!-- Specify the file name -->
                        <include>**/*TestRunner.java</include><!-- This will include all the file
                            which has "Runner" as suffix in their name -->
                    </includes>
                    <suiteXmlFiles>
                        <!-- <suiteXmlFile>${testngxml.location}/testng.xml</suiteXmlFile> -->
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

控制台日志如下:-

[INFO] 
[INFO] -------------------< org.example:com.CucumberHybrid >-------------------
[INFO] Building com.CucumberHybrid 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ com.CucumberHybrid ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ com.CucumberHybrid ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ com.CucumberHybrid ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/keshavmac/IdeaProjects/com.CucumberHybrid/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ com.CucumberHybrid ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 15 source files to /Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ com.CucumberHybrid ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.framework.runners.TestRunner
[INFO] Running com.framework.runners.ReRunTestRunner
Aug 10,2020 4:37:17 PM io.cucumber.core.runtime.FeaturePathFeatureSupplier get
WARNING: No features found at file:/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/Reports/rerun.txt
[INFO] Tests run: 0,Failures: 0,Errors: 0,Skipped: 0,Time elapsed: 0.851 s - in com.framework.runners.ReRunTestRunner
@run
Scenario: To test search functionality with blank submit                           # src/test/java/com/framework/features/Home.feature:7
[INFO ] 2020-08-10 16:37:18.331 [main] BaseSetup - New Webdriver instance invoked
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 84.0.4147.30 (48b3e868b4cc0aa7e8149519690b6f6949e110a8-refs/branch-heads/4147@{#310}) on port 8150
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Aug 10,2020 4:37:20 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
[INFO ] 2020-08-10 16:37:20.357 [main] BaseSetup - Chrome browser instance launched successfully
  When user opens browser and navigates to test url                                # com.framework.stepDef.Common_stepDef.user_opens_browser_and_navigates_to_test_url()
The page title verified is My Store
[DEBUG] 2020-08-10 16:37:28.123 [main] HomePage_PF - Banner on homepage of website has been validated.
  Given user should be on home page                                                # com.framework.stepDef.Home_stepDef.user_should_be_on_home_page()
[DEBUG] 2020-08-10 16:37:28.159 [main] HomePage_PF - Search field on homepage has been validated.
  And search textfield should be visible                                           # com.framework.stepDef.Home_stepDef.search_textfield_should_be_visible()
[DEBUG] 2020-08-10 16:37:30.526 [main] HomePage_PF - Search icon has been clicked.
  When user clicks on search button                                                # com.framework.stepDef.Home_stepDef.user_clicks_on_search_button()
      java.lang.AssertionError: expected [true] but found [false]
    at org.testng.Assert.fail(Assert.java:96)
    at org.testng.Assert.failNotEquals(Assert.java:776)
    at org.testng.Assert.assertTrue(Assert.java:44)
    at org.testng.Assert.assertTrue(Assert.java:54)
    at com.framework.stepDef.Home_stepDef.user_clicks_on_search_button(Home_stepDef.java:32)
    at ���.user clicks on search button(file:///Users/keshavmac/IdeaProjects/com.CucumberHybrid/src/test/java/com/framework/features/Home.feature:10)
  Then user should be displayed validation message "Please enter a search keyword" # com.framework.stepDef.ProductList_stepDef.user_should_be_displayed_validation_message(java.lang.String)
    Scenario To test search functionality with blank submit has been failed
    Embedding To test search functionality with blank submit [image/png 365303 bytes]
[INFO ] 2020-08-10 16:37:31.638 [main] HomePage_PF - Webdriver instance has been closed
[ERROR] Tests run: 1,Failures: 1,Time elapsed: 14.975 s <<< FAILURE! - in com.framework.runners.TestRunner
[ERROR] com.framework.runners.TestRunner.runScenario["To test search functionality with blank submit","Optional[To test the Search feature of application]"](1)  Time elapsed: 13.995 s  <<< FAILURE!
java.lang.AssertionError: expected [true] but found [false]
[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   TestRunner.runScenario expected [true] but found [false]
[INFO] 
[ERROR] Tests run: 1,Skipped: 0
[INFO] 
[ERROR] There are test failures.
Please refer to /Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date].dump,[date]-jvmRun[N].dump and [date].dumpstream.
[INFO] 
[INFO] --- maven-cucumber-reporting:3.16.0:generate (execution) @ com.CucumberHybrid ---
[INFO] About to generate Cucumber report.
[INFO] File '/Users/keshavmac/IdeaProjects/com.CucumberHybrid/target/Reports/JsonReport/report.json' contain 1 features

解决方法

我认为您只是缺少注解@,因此找不到任何功能。试试这个-

features = "@target/Reports/rerun.txt"


在评论部分进行讨论

重命名ReRunTestRunner,使其以“ T”之后的任何字母开头(TestRunner,原始功能文件),因为Cucumber会按字母顺序拾取功能文件

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-