我正在使用 Jenkins + Maven + Java 进行持续测试,最近添加了 Thucydides + JBehave。我对 Jenkins 和 Thucydides 还很陌生,所以在显示构建报告时遇到了麻烦。
我无权更改 Jenkins 配置,因此我无法添加一些插件来正确显示修昔底德报告。我可以使用现有的 Jenkins 插件将 Thucydides 报告附加到构建中,但我还需要一些标准的 JUnit 报告(用于正确的电子邮件通知等)。
JUnit“认为”有 28 个测试,而实际上有 6 个场景。Failsafe 插件生成报告 xml 文件,其中:
<testcase time="0.027" classname="java.lang.Object" name="BeforeStories"/>
<testcase time="0.032" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 2"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 3"/>
<testcase time="0.003" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 5"/>
<testcase time="0.011" classname="Scenario: 2 + 3 = 5" name="Scenario: 2 + 3 = 5"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 3"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 3\u200B"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 6"/>
<testcase time="0.009" classname="Scenario: 3 + 3 = 6" name="Scenario: 3 + 3 = 6"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 3\u200B"/>
<testcase time="0.003" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 4"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 7"/>
<testcase time="0.01" classname="Scenario: 3 + 4 = 7" name="Scenario: 3 + 4 = 7"/>
<testcase time="0.014" classname="Additional.story" name="Additional.story"/>
<testcase time="0.003" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 2\u200B"/>
<testcase time="0.001" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 2"/>
<testcase time="0.003" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 4"/>
<testcase time="0.01" classname="Scenario: 2 + 2 = 4" name="Scenario: 2 + 2 = 4"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 3\u200B\u200B"/>
<testcase time="0.001" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 5"/>
<testcase time="0.002" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 8"/>
<testcase time="0.009" classname="Scenario: 3 + 5 = 8" name="Scenario: 3 + 5 = 8"/>
<testcase time="0.004" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Given 3\u200B\u200B\u200B"/>
<testcase time="0.005" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="When adding 6"/>
<testcase time="0.001" classname="TestPhucydidesJBehave.jbehave.DefinitionSteps" name="Then equals to 9"/>
<testcase time="0.008" classname="Scenario: 3 + 6 = 9" name="Scenario: 3 + 6 = 9"/>
<testcase time="0.012" classname="Simple.story" name="Simple.story"/>
<testcase time="0.006" classname="java.lang.Object" name="AfterStories"/>
如您所见,那里有很多多余的东西。我不知道如何向 Failsafe 和 JUnit “解释”,“测试”——只是场景。
任何提示都会非常有帮助!