简体   繁体   English

确定 DUnitX 中的测试顺序?

[英]Determining the order of the tests in DUnitX?

Execution order of RegisterTestFixture does not work. RegisterTestFixture 的执行顺序不起作用。 DUnitX executing test cases randomly. DUnitX 随机执行测试用例。 How do I determine execution order of the tests in DUnitX?如何确定 DUnitX 中测试的执行顺序?

According to your comment you are doing some sort of integration testing which is totally fine to do with DUnitX.根据您的评论,您正在做某种集成测试,这对 DUnitX 来说完全没问题。

However also integration tests should be self contained and not depend on other tests or their order.然而,集成测试也应该是自包含的,不依赖于其他测试或其顺序。 For tests on a database you usually have code in setup to prepare the data you want to run tests with and teardown to revert the database to a known state (if the database supports transactions that is usually a way to use them).对于数据库上的测试,您通常在设置中有代码来准备要运行测试的数据,并进行拆卸以将数据库恢复到已知的 state(如果数据库支持通常是使用它们的一种方式的事务)。

The setup and teardown code or parts of them can reused across several tests that do different tests on the same data.设置和拆卸代码或其中的一部分可以在对相同数据进行不同测试的多个测试中重用。

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

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