User Tools

Site Tools


programmieren:testing:unittest:test_data

Test Data

Tests need Data, that is quite obvious, especially when testing things that directly access the database.

For example when trying to test you may need to delete an entry, which would be bad for continuing testing since the data is always changing and when you implement one new change all tests called afterwards may fail.

Thats what FIXtures are for. Fixtures as the name implies, fixate data. So you basically define one dataset and have it continously be loaded new, for each test, so the data stays the same.

Fixtures are also loaded into an independent database, separated from the actual local database so you can run tests without messing with your local data every time.

Of course you won't always need or want db data, so for making new entries or similar, you can simply fake an entry with somewhat realistic data.

If you wanna do so with slightly different datasets that give different outcomes you can use a data provider.

Data providers run a test for each entry in it, with the given dataset.

programmieren/testing/unittest/test_data.txt · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki