When unit-testing code, when I want to write code for db connect and db disconnect in the current framework, there is no place holder where we can do this a single time for all the test cases for one program.
In the unit-testing framework we have entry points which define the program flow, I’ve mentioned the entry points below in the order that it is executed:
- entry MFU-TC-METADATA
- entry MFU-TC-PREFIX
- entry MFU-TC-SETUP-PREFIX
- entry MFU-TC-TEARDOWN
All these entry points are executed each time a test case is run, so when we write a code for db connect and disconnect in the test program( in any one of the above sections), and I’ve 10 rows in the input CSV file, then the db connect and db disconnect statements will be executed 10 times.This will cause a performance issue down the line when we are running 100s of test cases for a single program. Is there a way we can control the flow or have a section which is executed only once before and after execution of all test cases written?