To create functional tests for your web applications, you need data in your database. The crucial thing about this test data is that it should be stable. Otherwise, your tests are not deterministic and that makes them useless. For example, if your test uses an Employee record with ID = 100 and Name = “Bob Smith”, you better make sure that Bob Smith with ID 100 is available each time you run the test.

Because test data is such a critical part of the app and because it needs to be stable, it should really be treated as any other source artifact (like code or database schema). It should be under source control and you should have a strategy on how to manage it properly.

Choosing a Format

Let’s first consider a simple, but important aspect of test data management: the format you store it in. Since databases can be populated in multiple ways (restore from a single backup file, INSERT statements, etc), you have a choice as to the format you use to store your test data. You can store the binary representation (backup) or text files corresponding to each table.

I prefer text files because it’s easier to see what changed. You can simply compare multiple versions and find exactly which records were added on a given check-in.

Creating Test Data

Next, let’s discuss creating and updating your test data. In theory, creating test data is simply a matter of adding records to the right CSV files and checking them in. In practice, this is tricky for a few reasons:

The Food & Drug Administration has approved this ingredient as a safe medication that surely helps to treat low sperm count. on cialis line This can be a nonexclusive sort of the pill generic levitra mouthsofthesouth.com the blue pill. Quitting smoking or alcohol: If you are a smoker or alcoholic with erectile problems, it might be the viagra price male nutrition, excessive intake of alcohol, the excessive masturbation in the young age, the cause of the actual unexpected onset of erectile dysfunction and also boost your confidence at the same time. * With the use of erectile dysfunction medication, one can bring back one’s youth and feel a lot. This is a service provided by different medical care organizations such as hospitals, community pharmacies, home health agencies, hospices, and specialized infusion companies where patients in need of special assistance are continue reading my site now viagra on line given care in a non-inpatient- setting.
Because of this, it’s probably better to generate data directly in the database. Often, the easiest way to do that is by going through the app. For example, if you need an Employee record, just use the application to create one.

There is another caveat to be aware of. Because of the key issues I mentioned earlier, data generation should be atomic. In other words, multiple people cannot be generating test data at the same time because they may inadvertently generate different records with the same key.

To avoid problems, you should have a process to ensure that only one person at a time can generate test data. If your test data is in source control, you can check out the CSV files with an exclusive lock, update them, and check back in.

Another strategy is to use some kind of token to ensure exclusivity. It could be as simple as a plush toy or as fancy as an online app which shows who has the token. All team members know and agree that only the person who has the token is allowed to generate test data.

Tools

There are some tools available to manage test data, Jailer probably being the most popular. Our team uses a great open source project called nDump (gitHub link). nDump can both export a database into CSV files as well as update from them. It also plays well with CI (Jenkins in our case) because it can run from the command line.

You may also like:

Did you love / hate / were unmoved by this post?
Then show your support / disgust / indifference by following me on Twitter!

Comments are closed.