While studying the current Selenium test cases, I came across a design/organisation issue.
This issue is related to redundant actions. For example, if we want to test the creation
of a table, we need to create a database. We create a database already in the 'create
database' test. Similarly, if go deeper into the flow, to test insertion of records in
a table, we need to create a table which in turns needs us to create a database. If we
have separate tests for these - (namely, 'Create a table', 'Insert a
Record') we will be doing some actions redundantly, that is creating a database and
creating a table and so on. Apart from the problem of redundancy, the tests will take a
longer time to execute unnecessarily.
The alternatives that we might go for are:
1. Create one single test that tests everything in the flow - creating a db -> creating
a table -> inserting records, searching, editing (and other tasks) -> drop table
-> drop db. The downside is that this will create a very long test in terms of length.
2. Enforce the pre-requisite of having a testdb and some tables in that test db
specifically for Selenium test cases wherever Selenium tests are supposed to be run. The
downside is that this will create an extra and perhaps unnecessary dependency on the
environment.
Looking for some inputs on which approach might be better.
Thanks!
--
Ayush Chaudhary