I’m wondering what some other options are for accessing the test automation framework dependencies from my test classes.
Right now I have a layered architecture:
Framework layer (contains all shared code for accessing deployed services)
Harness layer (builds the classes and dependencies within the framework. Ie handles DI)
Test layer (controls the flow of the tests via the objects created in the harness)
I’ve got a test base class in the harness layer that has access to the various API, database, and UI classes needed to run our tests. So using inheritance to provide access to these dependencies.
A sample test class would look like:
public class MyTestClass : TestBase
{
[Test]
public void sample_test()
{
APIs.MyAPI.GetSampleEndpoint(); // APIs is an inherited field in test base
}
}
I feel inheritance is the best way to go about the issue of dependencies within a test class. The downside is managing the wrapping class that the “APIs” field is attached to.
Are there better options to go about managing a large list of dependencies in a clean way?
Source: Read More