如何使C#测试按顺序进行?
我记得在一个论坛上阅读C#单元/集成/功能测试按字母顺序进行,但事实并非如此。我有1个保存所有测试的文件,并以这样的顺序将它们从上到下放置。
- a1_postFirstToreGisterClaimSadmin
- b2_createmasterWallettest
- c3_sendcoinstoprofile
- d4_logintest
那么如何使测试按顺序进行?
I remember reading on a forum that C# Unit/Integration/Functional tests run in alphabetically order but that doesn't seem to be the case. I have 1 file that holds all of my tests and I put them from top to bottom in order like this.
- A1_PostFirsttoRegisterClaimsAdmin
- B2_CreateMasterWalletTest
- C3_SendCoinsToProfile
- D4_LoginTest
But when I click "Run All Tests," it runs in this order.
So how do I get the tests to run in order?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于Xunit,您必须提供一个测试器。
然后,您必须用属性注释测试类才能使用此testorderer。
您可以在 Microsoft Docs
For xUnit you have to provide a TestOrderer.
Then you have to annotate your test class with an attribute to use this TestOrderer.
You can find more information about the ordering of unit tests in the Microsoft Docs