报告中不包括步骤

时间:2017-02-28 12:51:21

标签: reporting specflow

我正在创建报告,但不包括步骤(在问题结尾处查看屏幕截图!)。

  1. 我在VS15中创建了ClassLibrary1项目
  2. 我已经添加了NUnit3,NUnitConsole,Specflow和Specflow.NUnit nuget包。
  3. 我添加了默认功能和步骤定义文件。
  4. 之后,我从cmd运行这些命令(第一个来自nunit文件夹,第二个来自specflow文件夹):

    nunit3-console.exe --labels=All --out=TestResult.txt "--result=TestResult.xml;format=nunit2" D:\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll
    
    specflow.exe nunitexecutionreport D:\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj /out:MyResult.html
    

    正如我所看到的,输出HTML文件中没有包含步骤...我记得它在以前的版本中工作过,我看到了带有按钮的示例,例如' expand',这应该有助于查看确切的内容在场景中执行了步骤。 我错过了什么?

    TestResult.txt是

    => ClassLibrary1.SpecFlowFeature1Feature.AddTwoNumbers
    Given I have entered 50 into the calculator
    -> pending: StepDefinition1.GivenIHaveEnteredSomethingIntoTheCalculator(50)
    And I have entered 70 into the calculator
    -> skipped because of previous errors
    When I press add
    -> skipped because of previous errors
    Then the result should be 120 on the screen
    -> skipped because of previous errors
    

    TestResult.xml是

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <!--This file represents the results of running a test suite-->
    <test-results name="D:\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll" total="1" errors="0" failures="0" not-run="0" inconclusive="1" ignored="0" skipped="0" invalid="0" date="2017-02-28" time="12:37:46">
      <environment nunit-version="3.5.0.0" clr-version="4.0.30319.42000" os-version="Microsoft Windows NT 10.0.14393.0" platform="Win32NT" cwd="D:\Projects\ClassLibrary1\packages\NUnit.ConsoleRunner.3.6.0\tools" machine-name="DESKTOP-417JV6U" user="dom" user-domain="DESKTOP-417JV6U" />
      <culture-info current-culture="en-US" current-uiculture="en-US" />
      <test-suite type="Assembly" name="D:\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll" executed="True" result="Success" success="True" time="0.386" asserts="0">
        <properties>
          <property name="_PID" value="25444" />
          <property name="_APPDOMAIN" value="domain-" />
        </properties>
        <results>
          <test-suite type="TestSuite" name="ClassLibrary1" executed="True" result="Success" success="True" time="0.379" asserts="0">
            <results>
              <test-suite type="TestFixture" name="SpecFlowFeature1Feature" description="SpecFlowFeature1" executed="True" result="Success" success="True" time="0.378" asserts="0">
                <properties>
                  <property name="Description" value="SpecFlowFeature1" />
                </properties>
                <results>
                  <test-case name="ClassLibrary1.SpecFlowFeature1Feature.AddTwoNumbers" description="Add two numbers" executed="True" result="Inconclusive" success="False" time="0.118" asserts="0">
                    <categories>
                      <category name="mytag" />
                    </categories>
                    <properties>
                      <property name="Description" value="Add two numbers" />
                    </properties>
                    <reason>
                      <message><![CDATA[One or more step definitions are not implemented yet.
      StepDefinition1.GivenIHaveEnteredSomethingIntoTheCalculator(50)]]></message>
                    </reason>
                  </test-case>
                </results>
              </test-suite>
            </results>
          </test-suite>
        </results>
      </test-suite>
    </test-results>
    

    输出html看起来像: Output html looks like

1 个答案:

答案 0 :(得分:0)

您可以通过右键单击要素的文本并选择&#34;生成步骤定义&#34;

来生成步骤定义

这将生成Steps类,但它只包含抛出NotImplementedException的存根方法。

enter image description here