Open starosta33 opened 6 months ago
@Evangelink I think we have already other request for this one.
Yes mine :)
We need to be discussing the design of this feature as there are a couple of questions that come to my mind:
What are the cases where you found it useful @evangelink?
If I am not mistaken this can be done with a base class, which has the flexibility that point 1. above seeks, and does not require duplicating of all the options (point 3.)
Good question, the base class is indeed the most forward solution.
I was mainly thinking about scenarios where you have already many tests and want to introduce a common behavior or when your tests already have base classes and you want an easier solution than creating X intermediate base class that would add this init/cleanup behavior and inherit from the previous base class.
@starosta33 Would the base class be enough for your use case?
I think that this feature is "useful" to move from other adapters to MSTest, this functionality is available there and looks like the update of big tests suite to achieve the same semantic is "too much".
creating X intermediate base class that would add this init/cleanup behavior and inherit from the previous base class.
Another option here is to compose rather than inherit. So a helper that implements the setup would be added, and the existing base class would call it.
Another option here is to compose rather than inherit. So a helper that implements the setup would be added, and the existing base class would call it.
Yes definitely! I was thiking about the cases where the base class is not something you own.
I did not think about that 👍
the semantic should be something similar as below:
Note: this is allowed in NUnit already (
BeforeTest
&AfterTest
hooks)