Hi
Dne Mon, 12 Aug 2013 19:41:47 +0530
Ayush Chaudhary <ayushchd(a)gmail.com> napsal(a):
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.
I really did not look deeper into Selenium and PHPUnit integration, but
isn't it possible to do some setup before running test, which will
create tables used in the test?
I'd really prefer to have separate tests for each task (so that it is
can be easily seen what is broken), while the environment setup does not
have to be done using Selenium...
--
Michal Čihař |
http://cihar.com |
http://phpmyadmin.net