Data Driven Testing Solved for Guidewire
Data-driven testing is a great way to increase test coverage, reduce the number of tests written, organize your tests without duplication, and scale your testing. DDT increases implementation clarity and lowers maintenance costs. And by separating the test data from the test scripts, testers or analysts manage the data, and SDET’s or developers manage the scripts. But these benefits often come with a cost: writing and managing automated tests is hard. Let’s address these common misconceptions.
Writing DDT is hard?
Writing DDT tests is often challenging, so CenterTest takes a different approach from the norm. We start with a traditional test using hardcoded values, then have CenterTest bots convert it into a fully functional DDT test along with its data objects in seconds! CenterTest then reads these data objects without additional coding. We currently use Excel, the most common data store for DDT, but CenterTest can also support JSON, XML, databases, or most other types. The following test snippet was written with hard-coded values and then converted with AnkrPt bots. The result is a spreadsheet and the updated test. Note the use of referenced values instead of hard-coded values.
In the resulting spreadsheet, line 2 was generated from the hard-coded values. Lines 3 and 4 were manually added for additional tests.
Referencing your test data is easy, simply use the generated data object that corresponds to your spreadsheet. For example:
var data = new OotbData(scenarioContext.getTestData()); // reference the object
Once you have access to the Excel file, you can reference the individual sheets containing your data. For example:
var account = data.getAccount(); // get the Account var paymentPlan = data.getPaymentplan(); // the Payment Plan var address = data.getAddress(); // the Address var submission = data.getSubmission(); // the Submission var policyChange = data.getPolicychange(); // and the Policy Change
And finally, the columns within each sheet.
var addressLine1 = address.getAddressline1(); var city = address.getCity(); var state = address.getState(); var postalCode = address.getPostalcode(); var addresType = address.getAddresstype();
Now that you have access to the test data, that data drives your test. For example, the data can set a field’s value, clear it, or even ignore it outright. You can also assert the values or even manage the flow. CenterTest handles the complexities of many of these processes for you automatically, and what it doesn’t, you simply add to your test. As you can see, writing DDT is easy!
Companies often struggle to manage their test data over time. You may start with (Excel) files, then move to databases or other sources as your data grows and increases in complexity. This growth is what becomes unmanageable. Instead of letting your data grow out of control, CenterTest applies OO concepts to your data resulting in smaller, reusable pieces being shared and overridden as needed. These smaller pieces (in both size and number) are easier to understand, use, override, and, ultimately, manage. These principles significantly reduce your test data size while still letting you do everything you need. For example, only a few accounts, addresses, and contacts can support thousands of tests while allowing unique conditions when required. But how do we override the data? Thinking back to our generated excel file, let’s override the postal code. Once again, we get to the spreadsheet, then the sheet, and the value. But instead of reading it, we can override its value with “set” or “with.” That easy.
var dataObject = new OotbData(scenarioContext.getTestData()); // get your data dataObject.getAddress().withPostalCode("78664"); // modify the Postal Code
As shown above, approaching data differently makes managing data easy!
Don’t get left behind. Start using smart, data-driven testing. Easily write tests. Effectively manage your test data. Focus on your business and tests while we focus on the technology. AnkrPt CenterTest, purpose-built for Guidewire systems. Let’s get started… with a free trial.
Senior Software Architect
Watch or Read more CenterTest related posts, understand all features of CenterTest Automated Testing Framework for Guidewire, or Connect with us to understand how we can improve on effectiveness of your testing process.