Jenkins 我在詹金斯身上收到一条奇怪的信息

Jenkins 我在詹金斯身上收到一条奇怪的信息,jenkins,nunit,mstest,specflow,fluentautomation,Jenkins,Nunit,Mstest,Specflow,Fluentautomation,我想和詹金斯一起测试一个specflow项目。 我只能测试一个项目。我只需更改测试文件,使其显示没有要执行的测试消息。即使两个项目的内容相同,但项目名称不同。为什么这样?原因是什么? 请帮帮我,谢谢 信息是: Started by user anonymous Building in workspace C:\Program Files (x86)\Jenkins\workspace\test2 Path To MSTest.exe: C:\Program Files (x86)\Microso

我想和詹金斯一起测试一个specflow项目。 我只能测试一个项目。我只需更改测试文件,使其显示
没有要执行的测试
消息。即使两个项目的内容相同,但项目名称不同。为什么这样?原因是什么? 请帮帮我,谢谢

信息是:

Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\workspace\test2
Path To MSTest.exe: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe
Delete old result file file:/C:/Program%20Files%20(x86)/Jenkins/workspace/test2/TestResult.trx
[test2] $ "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" /resultsfile:TestResult.trx "/testcontainer:C:\Users\Documents\Visual Studio 2013\Projects\test\test\bin\Debug\test.dll"
Microsoft (R) Test Execution Command Line Tool Version 12.0.21005.1
Copyright (c) Microsoft Corporation. All rights reserved.

Loading C:\Users\Documents\Visual Studio 2013\Projects\test\test\bin\Debug\test.dll...
Starting execution...
No tests to execute.
Processing tests results in file(s) TestResult.trx
FATAL: No MSTest test report files were found.
FATAL: No MSTest TRX test report files were found. Configuration error?
Build step 'Publish MSTest test result report' marked build as failure
Finished: FAILURE
是的。我只是调试了所有的测试。我试着把specflowfeaturesteps.cs中的内容放到Unit.cs中,并试着用jenkins运行它。然后我发现它只测试了Unit test中的一个函数

信息:

已通过测试。UnitTest1.login 1/1测试已通过

specflowfeature.feature:

Given I login pages with default test user and password
Then the page should show 'http://' on the screen
specflowfeaturesteps.cs:

 [Given(@"I login pages with default test user and password")]
 public void login_success()
 {
     I.Open("http://");
     I.Enter("cherry").In("#loginName");
     I.Enter("****").In("#password");
     I.Click("input[value='Log In']");
 }

 [Then(@"the page should show '(.*)' on the screen")]
 public void check_URL(string p0)
 {
     I.Assert.Url((uri) => uri.GetLeftPart(UriPartial.Path) == p0);
 }

默认情况下,SpecFlow使用NUnit生成其测试。您确定SpecFlow正在生成MSTest测试吗

我会打开生成的单元测试文件(在FeatureFile.feature.cs之类的功能文件下),并检查其中的测试是NUnit测试还是MSTest测试

您还可以在配置中检查配置是否包含以下内容:

<specFlow>      
  <unitTestProvider name="MSTest" />
</specFlow>

或者这个:

<specFlow>
  <unitTestProvider name="NUnit" />
</specFlow>


另一种可能性是,代码在没有生成单元测试的情况下签入(尽管只有在visual studio之外修改了功能文件,或者您没有在vs内部使用specflow插件时才有可能这样做)

谢谢您的回答。但是jenkins似乎在测试UnitTest.cs文件。我如何才能让它测试specflowfeature文件?@cherry,你不能测试specflow功能文件,specflow不是这样工作的。Specflow从功能文件生成单元测试文件,然后任何测试运行程序都可以运行这些单元测试。您是否检查了specflow配置?在visual studio中打开解决方案时,可以看到通过打开
MyFeature.feature.cs
文件生成的单元测试,该文件是解决方案资源管理器树中MyFeature.feature文件的子文件。MSTest单元测试运行程序是否在VS中运行测试?
MyFeature.feature.cs
文件是否已签入?另外,如果答案不能解决您的问题,请不要将其标记为已接受。这只会让用户在将来遇到同样的问题。谢谢你的提醒。但我不明白你想说什么。我使用jenkins运行MSTest。specflowfeature.feature、NUnit.cs和specflowfeaturesteps.cs都在项目中。我在specflowfeaturesteps.cs中编写代码。好的,首先,您可以在Visual Studio中运行specflow测试吗?如果是这样的话,你是如何运行它们的?第二,请使用以下文件的内容更新问题:specflowfeature.feature和specflowfeature.feature.cs请添加specflowfeature.feature.cs而不是Specflowfeaturesteps.cs文件的内容