Replies: 5 comments 2 replies
-
|
In your case you use your own CancellationToken. Doesn't that cancel your tests? Note that you are not actually using NUnit's CancelAfter as your are not using its CancellationToken but using your own is also fine. |
Beta Was this translation helpful? Give feedback.
-
|
I know, was rewritten by my colleague in a hurry 😃 E.g. once in a while when multiple runs of the PR testings are ran simultaneously (multiple branches), it might hang and using Timeout+Retry was a good combo TBH Just curious if there is something you can come with off the top of ur head |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
@jzapletal95 That looks pretty good! Using -var exception = Assert.ThrowsAsync<ScriptExecutionException(() => ScriptExecutor.ExecuteScript(configuration, CancellationToken));
+var exception = Assert.ThrowsAsync<ScriptExecutionException(() => ScriptExecutor.ExecuteScript(configuration, TestContext.CurrentContext.CancellationToken));Or automatically passed in as a test argument: -public Task Execute_InvalidDirectoryParameter_Throws()
+public Task Execute_InvalidDirectoryParameter_Throws(CancellationToken cancellationToken)There's a bit more info on it here: https://docs.nunit.org/articles/nunit/writing-tests/attributes/cancelafter.html |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @stevenaw, |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys 👋 , please, I'm wondering
Using
TimeoutAttributewas a safety net, is there anything like that?We used Timeout set to 20s, CTS to 19s
We use blame-hang but it stops everything
Beta Was this translation helpful? Give feedback.
All reactions