简体   繁体   English

在ASP.NET Core 1.1中自动生成单元测试

[英]Auto-generate unit tests in ASP.NET Core 1.1

NOTE: I asked this on SoftwareEngineering site, but someone replied to the "where does my tooling question go", and that link said to ask on Stackoverflow (at least that's how I interpreted the answer)" 注意:我在SoftwareEngineering网站上问了这个问题,但是有人回答“我的工具问题去了哪里”,那个链接说要在Stackoverflow上问(至少这就是我解释答案的方式)”

I've had this in previous projects, but I don't see it in my new ASP.NET Core 1.1 project. 我在以前的项目中已经有过,但是在新的ASP.NET Core 1.1项目中却没有看到。

Previously, I could just right-click on a method or class and select "Create Unit Tests" or "Run/Create IntelliTest". 以前,我可以右键单击方法或类,然后选择“创建单元测试”或“运行/创建IntelliTest”。

After some googling, it looks like first versions of VS2017 or ASP.NET Core didn't have this feature yet. 经过一番谷歌搜索后,似乎VS2017或ASP.NET Core的第一个版本还没有此功能。

Has this been added yet? 是否已添加? If so, which versions of ASP.NET Core and Visual Studio do I need? 如果是这样,我需要哪个版本的ASP.NET Core和Visual Studio?

I have VS 2017 15.3.5 ASP.NET Core 1.1 我有VS 2017 15.3.5 ASP.NET Core 1.1

Thanks! 谢谢!

You said that you are using VS 2017, but you didn't specify which edition. 您说您正在使用VS 2017,但未指定哪个版本。 The IntelliTest feature is available in VS 2017 Enterprise . VS2017 Enterprise中提供了IntelliTest功能。 Check out Generate unit tests for your code with IntelliTest 签出使用IntelliTest为您的代码生成单元测试

Availability and extensions The Create IntelliTest and Run IntelliTest menu commands: 可用性和扩展“创建IntelliTest”和“运行IntelliTest”菜单命令:

  • Are available in only the Enterprise Edition of Visual Studio 2015 and later. 仅在Visual Studio 2015及更高版本的企业版中可用。

  • Support only C# code that targets the .NET Framework. 仅支持针对.NET Framework的C#代码。

  • Are extensible, and support emitting tests in MSTest, MSTest V2, NUnit, xUnit format. 可扩展,并支持以MSTest,MSTest V2,NUnit,xUnit格式进行测试。

  • Do not support x64 configuration. 不支持x64配置。

Also, read Generating Unit Tests with IntelliTest using Visual Studio Enterprise 2017 另外,请阅读使用Visual Studio Enterprise 2017使用IntelliTest生成单元测试

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

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