Avoid creating unnecessary test data

12 Jul

This post is with respect to writing automated tests.

In my tenure, I’ve witnessed some people just take for granted or take for liberty the creation of unnecessary test data. They may be doing it:

  • as a precautionary measure in case it is needed, but again it’s “precautionary”.
  • don’t know that you could do without the test data, or didn’t comtemplate whether that test data is really needed or not, just assumed it would be needed.
  • because it’s the standard/normal happy path route to take and is “easy” to do when creating tests.

One case in point:

The application offers functionality that works anonymously, and offers functionality that requires a login. Some functionality overlap between the two (you can do it with our without login, but get some extra features when logged in). And now, say you want to run tests concurrently in parallel, like with Selenium Grid, etc. When login accounts come into play you either need to have enough accounts dedicated to each test so that you don’t have account conflicts (from any modifications to data relating to account) when tests are  executed concurrently. Or you create new test accounts on the fly for each tests.

Some people just take that generalization and have all tests create an account  & login as a precondition (test setup), regardless if the test really needed to do so or not (based on analyzing whether the feature being tested required a login or not). Granted storage is cheap these days that it might not matter, but sometimes it does, and in any case, extra test data is just extra garbage in the system. More work to have to have tasks/scripts purge the data, or more junk that gets added to system if not purged, plus more crapped logged in application/server logs and database transaction logs.

I follow the lean testing approach, please avoid creating unnecessary test data if your test doesn’t actually need it. Do an evaluation of whether your test needs to do things that create test data. Examples of unnecessary test data in some cases:

  • creating account logins
  • adding additional info to an test account when not needed or used (address, name, age, likes, preferences, etc.)
  • saving projects/data without deleting them after test when there is option to do so (from the application)
  • creating account to test new account creation but not deleting account after test when there is option to do so (from the application)
  • adding items to (shopping) cart but not removing them at end of test (when leaving them in cart keeps junk data in the system)
  • placing test orders to the system without cancelling them afterwards

One might generate unnecessary test data from manual testing too, and should avoid it. But unnecessary data from automated tests becomes a bigger problem due to frequency of test runs and how many tests get run (regression suite grows over time).

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Der Flounder

Seldom updated, occasionally insightful.

The 4T - Trail, Tram, Trolley, Train

Exploring Portland with the 4T

Midnight Musings

Thoughts on making art

Automation Guide

The More You Learn The More You Play...!

The Performance Engineer

Code.Test.Tune.Optimize.

humblesoftwaredev

Thoughts related to software development

Yi Wang's Tech Notes

A blog ported from http://cxwangyi.blogspot.com

Appium Tutorial

Technical…..Practical…..Theoretically Interesting

LinuxMeerkat

I swear! Meerkats can do Linux

PacketsDropped

Requeuing the packets dropped in my memory.

Two cents of software value

Writing. Training. Consulting.

@akumar overflow

wisdom exceeding 140 chars.

Lazy Programmer's Shortcut

Java, J2EE, Spring, OOAD, DDD & LIFE! .......all in one :)

Testing Mobile Apps

www.SoftwareTestingStudio.com

Photofocus

education and inspiration for visual storytellers

No, Seriously...

Freeing up some mind cache!

Mike Taulty

I do some developer stuff for Microsoft UK

%d bloggers like this: