Replies: 5 comments 13 replies
-
Hey @MelGrubb - That ordering section in the readme refers to a more primitive "Order = 1" "Order = 2" functionality, similar to what other frameworks have. But there's also the "DependsOn" functionality which effectively orders your tests too, but without having to turn off parallelism. This should entirely be possible for you. Pseudocode:
Does that help? Bits that can run in parallel should automatically be worked out by the framework so you don't have to work it out yourself. Otherwise it'll wait as it needs to. |
Beta Was this translation helpful? Give feedback.
-
DependsOn doesn't currently supporting starting tests if its dependencies have failed. |
Beta Was this translation helpful? Give feedback.
-
This could be optimised by storing your data in the TestContext and using that in split out tests, to avoid having to retrieve over and over.
|
Beta Was this translation helpful? Give feedback.
-
The example given by him where testcase 3 could be many smaller tests 3a, 3b and so on makes me wonder whether it makes sense for the Fow example |
Beta Was this translation helpful? Give feedback.
-
Is there a chance the experience of this kind of test setup could be improved when running a specific test? Currently what happens is that all dependant tests are run in addition to the specific test. There is no possible way of specifying that a test is not required to be run for this this test to be run, but if it is included in the filter, it must be run before this test. Example: [Test]
public void CreateUser { ... }
[Test]
[DependsOn(nameof(CreateUser))
public void RetrieveUser { ... }
[Test]
[DependsOn(nameof(RetrieveUser))
public void CheckBackend { ... }
[Test]
[DependsOn(nameof(RetrieveUser))
public void UpdateEmail { ... }
[Test]
[DependsOn(nameof(UpdateEmail))
public void RetrieveUserAgain { ... }
[Test]
[DependsOn(nameof(CreateUser))
[DependsOn(nameof(RetrieveUser), ProceedOnFailure = true, Optional = true)
[DependsOn(nameof(UpdateEmail), ProceedOnFailure = true, Optional = true)
[DependsOn(nameof(RetrieveUserAgain), ProceedOnFailure = true, Optional = true)
public void DeleteUser { ... }
[Test]
[DependsOn(nameof(DeleteUser))
public void CheckDeleted { ... } Running just the Another "nice to have" feature would be to specify a reverse dependency, to ensure |
Beta Was this translation helpful? Give feedback.
-
I'm pretty excited about the parallel execution features here, but I have a couple questions. In the ReadMe, there's a bullet point for "Test ordering (if running not in parallel)". Does this mean it's an all-or-nothing thing? I'd love the ability to write CRUD style integration tests that can "fan out" in the middle.
1 - Create a new User
2 (Depends on 1) - Retrieve the newly-created User by Id
3 (Depends on 2) - Check that certain fields were filled in by the back-end
4 (Depends on 2) - Update user's email
5 (Depends on 4) - Retrieve the user based on the updated email
6 (Depends on 3, 4, & 5) - Delete the user
7 (Depends on 6) - Check that the user no longer exists
Tests 3 & 4 can be run in parallel since the initial user was retrieved in step 2.
4 needs to wait on 2 & 3 to make sure they're finished before it goes changing things.
6 needs to wait on 3, 4, & 5 so it doesn't delete the user before they're done with it, but importantly, 3, 4, & 5 don't have to PASS. They just have to complete.
This is a simple example, but I think you see what I mean. Step 3 could actually be multiple individual tests, checking multiple different properties in parallel. #4 would need to wait for 3a, 3b, and 3c to all finish before continuing. I think this is where I'd get the biggest payoff. As long as a set of tests don't mutate the object, they should all be able to run at the same time. I think this would speed a lot of things up in integration tests where each individual step can incur a delay. Those really start to add up when they run in series.
Beta Was this translation helpful? Give feedback.
All reactions