如何设置的xUnit测试用例序列 [英] How to set the test case sequence in XUnit
本文介绍了如何设置的xUnit测试用例序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我已经写在C#中的xUnit测试案例。这种测试类包含了许多方法。我需要在序列运行整个测试用例。我怎样才能在的xUnit设置测试用例序列
Hi I have written the Xunit test cases in C#. That test class contains so many methods. I need to run the whole test cases in a sequence. How can I set the test case sequence in XUnit?
推荐答案
Testpriority:在的这个页。
Testpriority: at the bottom of this page.
[PrioritizedFixture]
public class MyTests
{
[Fact, TestPriority(1)]
public void FirstTest()
{
// Test code here is always run first
}
[Fact, TestPriority(2)]
public void SeccondTest()
{
// Test code here is run second
}
}
顺便说一句,我现在有同样的问题。是的,它是不干净的艺术..但QA想要一个手工测试..所以用一个特定的顺序自动测试已经是他们的一个大的飞跃。(咳嗽)是的,它是不是真的单元测试..
BTW, I have the same problem right now. And yes, it is not the clean art.. but QA wanted a manual test.. so an automated test with a specific order already is a big leap for them.. (cough) and yes, it is not really unit testing..
这篇关于如何设置的xUnit测试用例序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文