Refactor tests to have less redundancy #253
Labels
effort: high
When you have a free weekend...
priority: medium
Nice to have...
refactor
Does not add new functionality, but alters existing ones
status: not started
tests
Milestone
Every test method has setup that is quite extensive in many and completely redundant in almost all cases.
To minimize the boilerplate code used for creating needed data, I am thinking about having global variables for the id's of common DB entries(maybe we can even save whole objects?) and provide a simple function to set up needed data.
Alternatively, we could add a
[TestInitialize]
attributed method to set up all available entries, reducing the number of code lines needed for setup to 0.The setup function could create a dictionary.
A function like
could then be reduced to
or like this, generating all data with defaults but executing a custom generator for the user:
This improves readability greatly by refactoring out non-essential code and leaving behind the actual test scenario(Resolving a mention in this case).
The text was updated successfully, but these errors were encountered: