Test Data Gen Techniques

A developer came onto the project and made some sweeping changing to the software. Then he left when funding problems arose. I was left to deal with the mess. My goal was to test the changes to see if anything got broke. I found myself lacking data to run all the regression tests.

I dreaded creating data from scratch. There are so many fields to each of the records. They have varying formats and rules. Plus the data is interrelated. Ouch. There was no time for this. Then I read a somewhat related article on generating data if you already have some.

The idea is to take some existing data, distort it, creating new data sets. Specifically I saw this applied to image data. You stretch an image in a non-uniform fashion. The result is a new image that can be used for test. The key is that you cannot use random stretching across the image. The streching of points must be related to the stretching of points in the local area.

There is a whole science behind image distortion. I did not dig deep. The idea let me implement something similar in my own development database. I first identified a really good record. Then I wrote some routines to replicate that data, distorting the fields that could not be the same. The result was a quick way to generate tons of data.

I am now a happy tester. The icing on the cake was that the changes made by the long gone developer all seem to work just like the original code. I am going to use the distortion technique to cook up a batch of test data for my own new changes to the system.

Test Report Formatting

We have a standard format for our unit test reports. There is a section at the top that identifies all kinds of information about what we are testing. Then there is a section in the middle for our test steps. Finally there is a section at the bottom where we list our test results. Aside from these major areas on the document, we are pretty free in how we write our documentation.

The most important part for me is the steps. That is the meat of the test documentation. I often ponder what the best way to document your test steps is. Our testing team usually has generic steps that try to show the intent of what they are testing. I like to document very specific steps that anyone could follow if they read the document.

The problem with my technique is that it is hard to see the big picture of what those steps are accomplishing. Sure I could read the steps, and remember back what was in my mind. However I think the document should be readable to anyone else as well. Perhaps a combination of detailed steps with occsaional commentary to explain the big picture are in order.

Marked as Passed

Our development team has delegated the first line of cutomer support to our internal testing team. The test team is to try to replicate problems reported by our customer. This cuts down on developers being distracted from their primary role. It is best if the internal testers can help the customers figure out what's wrong.

Recently the customers reported a very strange behavior in some of our new software. A tester got assigned the task to replicate the problem. This tester could not even get the applicaiton launched. She reached out to a developer for help. The developer produced a recent build for the tester to use. Then tester then was able to launch the app.

This tester proceeded to then try the steps documented by the customer trouble ticket. There was no trouble for the tester when she tried following the steps. She made the conclusion that they developer must have fixed the customer problem. The tester reported that the problem was fixed and verified. Management took this diagnosis as gospel. Promises were made.

Disaster ensued from this mix up. The customer thought they were getting a fix. They received no such correction. Imagine development's surprise when this thing came back to us. Development was sure they never resolved the problem that the customer raised. This was tracked down and the conclusion was that the tester was never able to recreate the problem voiced by the customer. This is much different than testing and passing a fix.

Breaking Tests

I've got a relatively mature set of code that generates unit test data for a complex program we have. This code has been developed over the past 5 to 6 years. It creates about 15 postive test cases for different scenarios in the program. It also can also generate the same amount of negative test cases.

This year we added three more test cases. So the test code was modified to produce three more positive test cases worth of data. Things were looking good. I had a long standing action item to create data for a whole separate path that the program sometimes takes. This resulted in a new slew of tests.

At first I had some trouble generating the test data for the new scenarios. But I dug down and determined what I needed to change to get everything set up. I pretty much based the data creation on the existing routines to produce data for the existing scenarios. I was happy when the task was complete.

I decided to do a round of regression tests to make sure the original test scenarios still worked. Ooops. Looks like I broke half of them. Good thing I have an easy way to run the whole suite of tests for the original scenario. But now I got to big back in to ensure the new and old unit test scenarios are correctly served.

Software Testing Class

I saw a posting for a free Software Testing course by Udacity. It starts up in a few weeks. I am busy this summer trying to relearn the Java programming language. However I always wanted to check out some online learning that does not suck. It seems that online is the future.

This course covers things such as code coverage (no pun intended). It also seems to spend a lot of time on random testing. I just finished up some unit testing. So this topic is very relevant to my job at work. The course is taught by John Regehr and Sean Bennett. To tell the truth, I don't know these guys. But they must be okay if they are approved to teach at Udacity.

I am not exactly sure how Udacity makes money. The courses seem free. Perhaps it is advertising funded? It looks like they don't require you to even buy a book. The whole school seems to be based on the Python programming language, which I have no experience in. I really want to get involved with some online learned that represents the education model to come.

Test Data Generation

We have a big need to generate test data to verify all kinds of functionality in our system. Personally I like to use Oracle PL/SQL to do the job. This is very practical. The data needs to be in our Oracle 11g database. What better way than to use some code compiled into the database?

Now PL/SQL does have some more advanced programming constructs such as collections. However you can't beat high level languages such as C++ or Java to have advanced features. I have been experimenting with writing some utility apps in Java.

The next step will be to start writing some Java apps to generate test data. I know how to use JDBC to do simple database queries and DML. Let's see where this takes me.

Automation Saves the Day

We have a new developer working on fixing some bugs. She got assigned a tough part of the system. The actual code is not too difficult. The testing is a real chore. The processes need a lot of requirements to be met before any of the data is processed. I have gone through this pain in the past while trying to test out large changes to this subsystem.

Luckily I performed a lot of tests and set up a data generation system. This system creates just the right data to test out all parts of the subsystem. I found this data generation to have come in handy when the test team could not figure out how to test any of this stuff.

The new developer was running a little behind schedule. She was finding, like all would, that it was next to impossible to test anything in this subsystem. I pointed her to the testing data generator and her problems were solved. Now she is teaching some testers how to use this tool to conduct their own test data sets. This tool is going a long way to making peoples' lives easier. Mine included.