Replies: 1 comment 7 replies
-
|
Right now, no. But the plan is it'll allow sync and Async. I was trying out a way with an expression to just point to the method, to get a method info, and not actually care if it's Async or not, but it didn't quite work how I envisioned. I might just have to settle for two properties. Sync and Async. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @thomhurst and all who may find it interesting,
I have specific requirements that I want to resolve using TUnit (which looks fantastic, by the way, and very promising).
I need a solution for testing an async tree-like structure, which may vary from case to case. The following example will be mostly made up because of company policy, but I will try to make it as close to the real case as possible.
I have a bunch of devices from which I can request the menu structure. Under the hood, all the data is requested via REST API, so I need to use async logic. The menu structure may look the following:
On the C# side, the nodes are defined in the following way:
The implementation of all this stuff does not actually matter in this post.
I want to automate the testing of these menu structures independently of a device. The problem is that the menu structure itself is usually very different from device to device. I cannot implement a bunch of tests that verify all the possible menu structures, their submenus, and the data of those submenus. It just won't work most of the time.
Instead, I want to connect to a device before running the tests, figure out what menus and submenus we have, and then create tests dynamically in the runtime for verifying the data of the menus/submenus.
https://tunit.dev/docs/experimental/dynamic-tests looks very promising and it's basically what I need.
The only problem I find in the approach of
DynamicTestis that it's not really async (at least it can't be as of v0.19.32).DynamicTestBuilderattribute expects only a sync test method, whileDunamicTest.TestMethodis anExpression<Action<TClass>>. So, in both solutions, there can't be any async test methods, which is not good for my case.How would you define a solution for asynchronously creating dynamic tests with asynchronous test methods without blocking anything?
Is there any other potential solution?
Beta Was this translation helpful? Give feedback.
All reactions