Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a bunch of unittests written in python in which messages (text) of any kind is used. Instead of 'hardcoding' the text examples used for the tests I would like to use a database of some kind (simple text file, pickle file) which contains such test examples, and which can be extended either manually or automatically very easily.

Is there a dedicated framework/module available, or do I do this simply on my own and create a simple text file? Maybe there are some best practices available I can follow?

share|improve this question


You might want to look at some of the answers to this question: What are some good approaches to separating test data from test scripts?

It's not specifically aimed at unit tests, but the general principle is similar. If your unit test framework doesn't support a data source attribute or declaration, you could design your own method of using external data sources.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.