我目前正在根据这篇文章设计一个可以运行 Silverlight 测试的 TFS 2010 构建流程:
http://pyxis-tech.com/blog/2011/01/24/how-to-run-silverlight-automated-tests-on-tfs-build-server/
我' StatLight 生成了 MSTest 通用格式的结果文件,这非常棒。但是,我现在需要在构建中发布结果,以便失败的测试将破坏构建。
上面的文章提到使用自定义活动来解析 StatLight 输出并发布失败,但实际上并未提供代码,因此我不知道在这里该怎么做。
理想情况下,我会使用用于运行正常测试的标准 MSTest 活动来发布测试结果,因为我希望尽可能避免自定义活动,但我不知道这是否可能。
有人可以在这方面提供一些帮助吗?除了上面的文章之外,我在网上找不到任何内容。
I'm currently in the processing of designing a TFS 2010 build process that can run Silverlight tests, based on this article:
http://pyxis-tech.com/blog/2011/01/24/how-to-run-silverlight-automated-tests-on-tfs-build-server/
I've got StatLight generating the results file in MSTest generic format, which is great. However, I now need to publish the results in the build so that a failed test will break the build.
The article above mentions using a custom activity to parse the StatLight output and publish failures, but doesn't actually provide the code, so I have no idea what to do here.
Ideally I would publish the test results using the standard MSTest activity which is used to run our normal tests, as I would like to avoid custom activities if at all possible, however I don't know if this is possible.
Can anyone provide some assistance in this area? I can't find anything on the web other than the article above.
发布评论
评论(2)
我还按照 Pyxis 博客中的描述在 TFS 中进行了集成(我看到我的前同事仍然热衷于使用 TFS)。
它工作得很好,除了我意识到我有很多 SLUnitTests 的“类别”:
- 其中一些可以直接连接到 TFS,
- 其他人需要我做一些额外的工作(安全帐户,允许进程交互,...)。
然后,我遇到了与您相同的问题:如何轻松停止错误签入(即避免编写额外的 C# 代码等),并避免从 DropFolder 进行手动检查?
我在这里找到了一个替代解决方案,基于集成到 Visual Studio 2010 和 TFS 2010 的通用测试。因此更容易配置:
http://www.nielshebling.de/?p=167
另一种可能性是使用CodePlex 项目,为您提供模板:
http://statlightteambuild.codeplex.com
希望这会有所帮助,
Vincent THAVONEKHAM。
I also did the integration in TFS as described in the Pyxis' Blog (I see my ex-colleague is still keen in using TFS).
It works fine, except that I realised I got many "categories" of SLUnitTests :
- some of them could be connected to TFS straight after,
- others required me some extra work (security accounts, allow process to interract, ...).
Then, I was facing the same issue as you: How to EASILY STOP a check-in on error (i.e. avoid writing extra bits of C# code, etc...), and avoid manual checks from the DropFolder ?
I found an alternative solution here, based on Generic Tests integrated to Visual Studio 2010 and TFS 2010. Hence easier to configure:
http://www.nielshebling.de/?p=167
Another possibility is to use a CodePlex project, which provides you templates:
http://statlightteambuild.codeplex.com
Hope this helps,
Vincent THAVONEKHAM.
Codeplex 项目 “NUnit for TeamBuild” 中也有类似的实现。
这个项目是关于获取 NUnit 结果,使用 XSLT 将它们更改为 MSTest - 就像输出和测试一样。然后将它们发布到 TFS 2010
。打开解决方案,您可能会通过检查并重做
Publisher2010.cs
中的操作来找到实现目标的方法。重做这些操作将导致在每个构建的“摘要”视图中发布测试结果。
由于单元测试失败而导致构建失败需要一些额外的处理,首先要检索它并进行后续处理。然后降低你的构建以防万一你检测到失败。
如果 NUnit 的返回代码不是“0”,则会报告“失败”,因此我将第一步放在实现 NUnit 调用的 InvokeProcess 的“结果”中。
紧接着,我放置了一个“if”来检查此返回。如果它与“0”不同(因此一个或多个测试失败),我将使用“SetBuildProperties”活动,这样我就可以将“TestStatus”设置为
BuildPhaseStatus.Failed
There is a similar implementation in Codeplex Project "NUnit for TeamBuild".
This project is about taking NUnit results, changing them with XSLT into MSTest - like output & then publish them onto TFS 2010.
If you grab the code & open the solution, you might find your way to your goals by reviewing-redoing the actions within
Publisher2010.cs
.Redoing those actions will lead to publishing your test results in the Summary view in each of your builds.
Failing your build due to failing unit test needs some extra handling, at first to retrieve it & then to degrade your build in case you detect the fail.
NUnit reports 'fail' if its' return code is anything else than '0', so I 've placed my first step in the 'Result' of the InvokeProcess that implements the NUnit call.
Directly after that, I have placed an 'if' checking this return. If it differs from '0' (so one or more tests failed), I use the 'SetBuildProperties' activity, so I can set 'TestStatus' to
BuildPhaseStatus.Failed