• 测试框架 MSTest V2与单元测试

    对于测试,其实不用顾虑那么多,随便选择吧,MSTest对VS的集成是最好的,而且也很容易上手,如果哪一天碰到它所无法解决的事情,切换到其他框架也非常简单,仅仅只是Nuget下个包,换下特性而已。测试用例组成单元测试方法名应具有可读性,让整个测试方法在不需要注释说明的情况下可以被读懂。<被测试方...

    2023-10-24 08:13:40
  • 使用MSTest进行单元测试入门

    我之前写过一篇XUNit的简介:使用Xunit来进行单元测试。Xunit在当时确实是一个最简单易用的测试框架,然而,随着发展,Xunit也变得复杂了不少,光写一个最简单的测试就要导入8个包。如果在大一点的项目中使用到还罢了,但如果只是随手想写一点单元测试引入这一堆包确实看着不大舒服。于是我又看了下M...

    2023-03-10 22:22:06
  • 让编写的单元测试同时支持 NUnit/MSTest

    让单元测试代码同时支持NUnit/MSTest,可以参照MSDN magazine,也可以参看 Switching Between Using NUnit and MSTest for Unit Testing 和 Using both MSTest and NUnit?using System;#...

    2023-03-10 22:21:54
  • 无法在 MSTest 项目中加载文件或程序集“Microsoft.Extensions.Configuration.Abstractions,版本 = 3.1.0.0"

    我在使用 MSTest 时遇到问题,问题在这里I'm having problem with MSTest, Here the issue 打开 VS2019 确保包管理设置为 [PackageReference]创建一个 .Net Framework...

    2022-07-23 14:13:40
  • 如何使用&QUOT;外部&QUOT;配置文件(即带有configSource)与MSTest的单元测试项目?

    为简单起见,我一般分裂了很多我的配置(即的app.config和web.config文件中的内容),分为不同的.config文件,然后从使用'configSource'属性的主配置文件中引用它们。例如:For simplicity, I general...

    2022-07-17 00:01:05
  • 从通用基础测试继承类MSTest的被忽略

    在创造MSTest的通用基础测试类,并从它继承,我无法运行所有的继承类的测试。When creating a generic base test class in MSTest, and inheriting from it, I'm unable t...

    2022-07-15 16:14:24
  • 对MSTest的全球测试初始化​​方法

    快速的问题,我如何创建一个只运行一次,在解决方案中的所有测试运行之前的方法。 Quick question, how do I create a method that is run only once before all tests in the solution are run.

    2022-06-15 16:42:21
  • 在MSTest中,如何找到要在ClassInitialize或AssemblyInitialize中运行的测试总数?

    使用MStest-我想查找排队等待运行的测试方法的总数. Using MStest - I want to find the total number of test methods which are queued for run. 如何在Class...

    2022-06-15 16:37:43
  • 在MSTest运行时动态创建单元测试方法

    MSTest中是否有SuiteBuilder的等效项?到目前为止找不到一个.Is there an equivalent of SuiteBuilder in MSTest? couldn't find one so far.我有一堆xml文件,每个...

    2022-06-15 16:37:37
  • NUnit 参数化测试的 MSTest 等价物?

    NUnit 支持一项功能,您可以为要多次运行的单元测试指定一组数据输入.NUnit supports a feature where you can specify a set of data inputs for a unit test to be ...

    2022-06-15 16:37:37
  • 使用Moq和MSTest测试异常的正确方法

    对于Moq与MsTest的行为有些困惑.A little confusion as to the behaviour of Moq with MsTest.这不是如何测试"的问题.或我该如何断言?",这是查看MoQ的工作原理的便笺簿,因此请不要关注异常...

    2022-06-15 16:32:59
  • 如何告诉MSTEST在解决方案中运行所有测试项目?

    我需要知道如何告诉MSTEST在解决方案文件中运行所有测试项目.这需要从命令行完成.现在,我必须将特定的项目文件传递给它,我正在尝试使其从SOLUTION文件运行.I need to know how to tell MSTEST to run all...

    2022-06-15 16:32:47
  • 了解MSTest TestContext

    使用MSTest,我需要从[TestInitialize]方法中获取当前测试的名称.您可以从TestContext.TestName属性中获取.Using MSTest, I needed to obtain the name of the curre...

    2022-06-07 19:22:21
  • MSTest中[TearDown]和[SetUp]的替代方案是什么?

    当我使用MSTest Framework并复制Selenium IDE为我生成的代码时,MSTest无法识别[TearDown]和[SetUp].有什么替代方法? When I use MSTest Framework, and copy the code that Selenium IDE generated for me, MSTest doesn't recognize [TearDown] and [SetUp]. What is the alternative to this?

    2022-05-29 23:03:53
  • 如何在ASP.NET Core项目中使用MStest测试Ok()结果

    我正在使用MStest来测试我的控制器.I'm using MStest for testing my controllers.我要测试此操作:[HttpGet(Name = "GetGroups")]public async Task<IAct...

    2022-05-28 22:38:25
  • JUnit与MSTest

    执行test类的每个方法时,需要做一些初始化。比如初始化applicationcontext。JUnit使用@Before注解。import org.junit.Before;import org.junit.Test;import org.junit.runner.RunWith;import o...

    2022-05-28 00:09:16
  • 什么是替代在MSTest的[设置]和[TearDown中]

    当我使用MSTest的框架,复制硒IDE对我产生code,MSTest的不承认TearDown中和设置。什么是可以替代的? When I use MSTest FrameWork, and copy the code that Selenium IDE generated for me, MSTest doesn't recognize TearDown and Setup. What is the alternative to this?

    2022-05-27 10:29:10
  • 我在NUnit中有什么可以在MSTest中做的吗?

    这个问题已经在许多不同的论坛上以各种形式提出,但是恕我直言,我一直无法找到一个真正能清楚回答的地方,因此,我将重新整理它并再次询问This question has been asked in various forms in a number of ...

    2022-05-26 21:59:52
  • 如何使用来自 Rider 或 VS 2017 的 NUnit、xUnit 或 MSTest 测试 .NET Standard 2 库?

    我有一个使用 Azure Durable Functions 的项目,它们是仅在 .NET Standard 2 上可用.因此,它定义了可以在测试项目中使用的类库.但是,我无法将 xUnit、NUnit 或 MSTest 用于单元/集成测试的库放在一起...

    2022-05-25 12:46:06
  • 如何使用Rider或VS 2017中的NUnit,xUnit或MSTest测试.NET Standard 2库?

    我有一个项目,其中使用 Azure持久功能,它们是仅在.NET Standard 2上可用。因此,它定义了可以在测试项目中使用的类库。但是,我无法将在单元/集成测试中使用xUnit,NUnit或MSTest的库放在一起。I have a project...

    2022-05-25 12:46:00