Our test cases are not wholly independent standalone entities. They can’t be! Yes, we realize that this violates a best practice, but our test cases are dependent on the environment to be set up correctly (test database(s) / file source(s) are prepared, certain settings within the GUI to be set). These dependencies eat up a lot of time if each test case checks the environment and then sets up the environment. So, we’ve set up our tests in various test groups. The test group houses a setup file that prepares the environment and then runs multiple test cases.
Well, let’s say one test case fails. Let’s say that a developer wants to rerun only that test case. Under the aforementioned structure, we don’t have a way for the developer to run just one test case because our test cases are not standalone entities.
We created a global test driver that a developer can use to call a test case. The test driver sets up the environment specific to that test case. Some variables need to be modified by the developer to make this work. Each test folder has a test case constants file which the developer needs to import into this test driver file. Now, if the developer chooses to run a different test, then the developer needs to modify the testcase name, the import statement calling the test case constants file, and other test specific information. Ideally, we could generate a script based on the test case name that would dynamically create a setup script, but for now our solution will suffice