简体   繁体   English

是否可以定义从IntelliTest生成的测试数量?

[英]Is it possible to define the number of tests which are generated from IntelliTest?

Basically title. 基本上是标题。

I just got into IntelliTest and started with a parameterized Test. 我刚进入IntelliTest并从参数化测试开始。 When I Run IntelliTest it generates a new [TestClass].[TestMethod].g.cs with a couple of calls to my new test method. 当我Run IntelliTest它将生成一个新的[TestClass].[TestMethod].g.cs其中包含对我的新测试方法的几次调用。 Is it possible to define the number of tests which are generated? 是否可以定义生成的测试数量?

Yes. 是。

A PUT (Parameterized Unit Test) serves as the specification for the code under test and determines the tests that are generated. PUT(参数化单元测试)用作被测代码的规范,并确定生成的测试。

But since you are new to IntelliTest, see here https://devblogs.microsoft.com/devops/smart-unit-tests-a-mental-model/ to get an overview of how IntelliTest goes about exploring your code in order to generate a compact test suite with high coverage. 但是,由于您是IntelliTest的新手,因此请参阅https://devblogs.microsoft.com/devops/smart-unit-tests-a-mental-model/,以大致了解IntelliTest如何探索代码以生成代码具有高覆盖率的紧凑型测试套件。

To get most control over the tests that are generated, write your own PUT for IntelliTest to use. 为了最大程度地控制所生成的测试,请编写自己的PUT供IntelliTest使用。 See here for an example of writing a PUT: https://devblogs.microsoft.com/devops/intellitest-hands-on/ . 有关编写PUT的示例,请参见此处: https : //devblogs.microsoft.com/devops/intellitest-hands-on/

Furthermore, you can configure these exploration bounds, which in turn can influence the number of tests that might get generated. 此外,您可以配置这些探索范围,进而可能影响可能生成的测试数量。 See here https://docs.microsoft.com/en-us/visualstudio/test/intellitest-manual/?view=vs-2019 (under "Exploration Bounds") for details on all the bounds that can be configured. 有关可以配置的所有范围的详细信息,请参见此处https://docs.microsoft.com/zh-cn/visualstudio/test/intellitest-manual/?view=vs-2019 (在“探索范围”下)。

Also, here is a larger set of references on IntelliTest for your reading: https://github.com/pvlakshm/Samples/blob/master/IntelliTest/references.md . 另外,这里还有更多关于IntelliTest的参考资料供您阅读: https : //github.com/pvlakshm/Samples/blob/master/IntelliTest/references.md

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

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