A few days back when I was starting with DB Testing, I was clueless where to start from. I went through many articles but only understood the theory involved with DB Testing. I didn't know how to implement it in automation testing.
To get a clear idea of the topic I approached my mentor and she provided me with a basic idea about CRUD (create, read, update and delete). These four processes are always involved in any database. She asked me to automate the four process. This needed me to follow these steps:
To get a clear idea of the topic I approached my mentor and she provided me with a basic idea about CRUD (create, read, update and delete). These four processes are always involved in any database. She asked me to automate the four process. This needed me to follow these steps:
- Create a DB.
- Create a table for the DB.
- Insert tuple into the table.
- Read from the tuple.
- Update the tuple.
- Delete the tuple.
These steps covered all that was required to cover CRUD. But the real challenge was to automate these steps. I started with keeping each tests in separate test classes and then added them in sequence to a test suite but that was a little complex approach and took a lot of space. So my mentor advised me to improve it. In the next approach I kept the functions (create, read, update and delete) in one class inside different methods for each and kept all the tests in the same test class. I predefined the order of execution of these tests to ensure proper ordering so that deletion does not occur before create. This I achieved by using @FixMethodOrder(MethodSorters.NAME_ASCENDING) available in Junit. This approach was better than the previous one and I was finally able to automate the process !
Here are a few articles that really helped me get a deep insight into DB testing: