标签: specrun

在SpecRun/SpecFlow测试执行报告中插入屏幕截图

我使用SpecFlow硒的webdriverSpecRun为测试运行,以创建和执行自动化测试案例,我正在寻找一个解决方案,在插入测试执行报告截图.

我写了一个方法来在每个Assert函数后创建截图.图像保存到特定位置,但是当我进行结果分析时,我必须遵循报告和图像.将它们放在同一位置(恰好在报告html中)会很不错.

有没有办法执行此操作(类似于控制台输出)?

c# selenium specflow specrun test-reporting

2
推荐指数
1
解决办法
9658
查看次数

SpecFlow会跳过场景,如果它之前的场景失败了断言

我有一些在我的功能文件中编写的方案,其中包含断言.如果第一个场景未通过断言,则Specflow将跳过其后的所有场景.我希望我的所有场景都能继续运行,即使它们在NUnit中失败也是如此.我使用SpecRun作为测试提供者,我在SpecFlow网站上找不到任何可以帮助我的东西.可能是我在App.config文件中遗漏了什么?

以下是我的App.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
    <unitTestProvider name="SpecRun" />
    <!-- setting flag to continue on first assert error -->
    <runtime stopAtFirstError="false" />
    <plugins>
      <add name="SpecRun" />
    </plugins>
  </specFlow>
</configuration>
Run Code Online (Sandbox Code Playgroud)

.net selenium automation specflow specrun

2
推荐指数
1
解决办法
2650
查看次数

SpecFlow 未发现测试或我收到错误消息

对于初学者:我总体来说是 Visual Studio 和 SpecFlow 的新手。

根据 SpecFlow 的入门文档,我得到了 2 个不同的结果,具体取决于我启动的项目类型。

单元测试项目:在此类项目中,运行者根本无法识别测试。仅运行“SpecRun评估”测试。

MSTest 测试项目(.NET Core):在这种类型的项目中,测试总是通过,但我确实在测试输出中收到错误:“值不能为空。参数名称:消息”,这是由“生成器”引起的

我在典型的 Windows 10 Pro 上完成所有这些操作。我在 VS 2017 和 2019 上都尝试过。我尝试过重新执行整个过程,以防我错过了什么。还尝试更新软件包。也许应该注意的是,单元测试项目不会生成 App.config 文件。

using System;
using TechTalk.SpecFlow;

namespace Tests.Steps
{
    [Binding]
    public class CalculatorSteps
    {
        [Given(@"I have entered (.*) into the calculator")]
        public void GivenIHaveEnteredIntoTheCalculator(int p0)
        {
            Console.WriteLine(p0);
        }

        [Given(@"I have also entered (.*) into the calculator")]
        public void GivenIHaveAlsoEnteredIntoTheCalculator(int p0)
        {
            Console.WriteLine(p0);
        }

        [When(@"I press add")]
        public void WhenIPressAdd()
        {
            Console.WriteLine("add pressed");
        }


        [Then(@"the result …
Run Code Online (Sandbox Code Playgroud)

c# specflow specrun

0
推荐指数
1
解决办法
2691
查看次数

标签 统计

specflow ×3

specrun ×3

c# ×2

selenium ×2

.net ×1

automation ×1

test-reporting ×1