简体   繁体   English

C#和WPF项目的自动化测试和持续集成

[英]Automated testing and continous integration of C# , WPF project

Is there a way to do automated testing and continous integration of C#, WPF projects? 有没有办法对C#,WPF项目进行自动化测试和持续集成? I thought about something like Jenkins but as far as I know Jenkins does not support C# projects. 我考虑过类似Jenkins的事情,但据我所知Jenkins不支持C#项目。 It should be a tool to do test driven development with the possibility to do automated testing, also for the GUI. 它应该是进行测试驱动开发的工具,并且还可以对GUI进行自动化测试。 Maybe the build tool form gitlab is an option? 也许构建工具表单gitlab是一个选择?

Many thanks in advance! 提前谢谢了!

We do use Jenkins with our C# projects. 我们在C#项目中确实使用了Jenkins。 You may use the MSBuild plugin to build the projects, or use a "Windows Batch Command" like 您可以使用MSBuild插件来生成项目,也可以使用“ Windows Batch Command”之类的

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" YourSolution.sln  /tv:4.0 /p:Configuration=Release /p:TreatWarningsAsErrors="true"  /p:CheckForOverflowUnderflow="true" /p:WarningLevel=4 /v:m /t:rebuild

Note: with this command line, I overwrite project specific settings for warnings and arithmetic overflow. 注意:使用此命令行,我将覆盖项目的特定设置,以用于警告和算术溢出。

There are also plugins for Unit Tests. 也有用于单元测试的插件。 We use MSTest. 我们使用MSTest。 Since I integrated the OpenCover Code Coverage Report Generator, I must use a long command line: 由于我集成了OpenCover代码覆盖率报告生成器,因此必须使用较长的命令行:

"C:\Program Files (x86)\OpenCover\OpenCover.Console.exe" "-target:C:\vs\Common7\IDE\MSTest.exe" "-targetargs:/nologo /testcontainer:Tests\Project1Tests.dll /testcontainer:Tests\Project2Tests.dll /resultsfile:testresult.trx /category:"^!SqlTests^&^!Perfomance"" -output:coverage.xml
"C:\Program Files (x86)\OpenCover\OpenCoverToCoberturaConverter.exe" -input:coverage.xml -output:outputCobertura.xml -sources:%WORKSPACE%
"C:\Program Files (x86)\ReportGenerator\ReportGenerator.exe" -reports:coverage.xml -targetDir:CodeCoverageHTML

Sadly, you mstest does not accept wild cards for the test projects, so you end up with a terribly long line. 可悲的是,您的mstest不接受测试项目的通配符,因此您的行尾非常长。 Also note that the above command line excludes test categories "SqlTests" and "Performance". 另请注意,上述命令行不包括测试类别“ SqlTests”和“ Performance”。 Then the output is converted to a format accepted by other plugins. 然后将输出转换为其他插件接受的格式。

You may start some virtual machines after the build and the unit tests, and install there your programs by some scripts complete with some test data and do some automated tests of the system. 您可以在构建和单元测试之后启动一些虚拟机,然后通过一些脚本(其中包含一些测试数据)来安装程序,并对系统进行一些自动化测试。

For the GUI proper, we do not yet have a test strategy. 对于适当的GUI,我们还没有测试策略。

There are a lot of options to pick from if you are going to use out of the box MS Test. 如果您要使用开箱即用的MS测试,则有很多选项可供选择。 Otherwise you need to check if the service provider can support xUnit runner or other similar testing frameworks that could be used in your solution. 否则,您需要检查服务提供商是否可以支持xUnitRunner或其他可以在您的解决方案中使用的类似测试框架。

  1. TFS / VisualStudio Online TFS / VisualStudio在线
  2. TeamCity TeamCity的
  3. Jekings with MSBuild MSBuild的杰克斯
  4. Bamboo
  5. Appveyor Appveyor

For UI Automation you could check White Framework . 对于UI自动化,您可以选中White Framework It is by far the nicest one in my opinion if compared to features and ease of use. 我认为,与功能和易用性相比,它是迄今为止最好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM