RE: [PEAR-QA] Unit tests requiring a database or other system specific infos
| From: | Lukas Smith | Date: | Tue, 02 Sep 2003 10:18:21 +0000 |
| Subject: | RE: [PEAR-QA] Unit tests requiring a database or other system specific infos | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-174@lists.php.net to get a copy of this message | ||
> From: Daniel Khan [mailto:dk@webcluster.at]
> Sent: Tuesday, September 02, 2003 12:12 AM
> I am currently writing unit tests for DB_NestedSet.
> For this tests access to a database is essential.
> I don't think that it's in the spirit of unit tests to require the
user
> to hack around inside of the main test class to provide the
credentials
> for the database access.
>
> So how can this be done?
>
> So I am seeing 2 possible ways atm:
> 1. The user provides a .ini file and passes this to the testscript.
> 2. I create a shellscript which asks for the credentials, creates a
test
> database and runs the tests in it. Some packages in CPAN do this.
Well in MDB the user does have to copy a test_setup.dist file to
test_setup and enter in the username, password etc.
Aside from that he doesn't need to do anything but run the test suite.
The test db is automatically created etc.
> The main question is if this is an overkill. Is automatic testing
really
> needed? ATM the unit tests are mainly a way for me to don't break
> exiting features while extending the package.
Yes automatic testing is really needed. It makes a huge differences.
Especially in terms of BC. Little things might slip through. However a
well written unit test suite will prevent this sort of thing.
Regards,
Lukas