我正在创建报告,但是没有包括步骤(请看问题末尾的截图!)
之后,我从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文件中.我记得它在以前的版本中起作用,我看到了像“展开”这样的按钮示例,这应该有助于查看在场景中执行的准确步骤。我错过了什么?
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 errorsTestResult.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如下所示:

发布于 2017-02-28 13:55:30
您可以通过右键单击该功能的文本并选择“生成步骤定义”来生成步骤定义。
这将生成Steps类,但它将只有抛出NotImplementedException的存根方法。

https://stackoverflow.com/questions/42509250
复制相似问题