In the last part we introduced the Given..When..Then structure for writing User Acceptance Tests and showed how TrialGrid automates execution of these tests against Medidata Rave and also how the tests can be checked for validity before they are even run. In this final part we'll look at automating the generation of tests for Edit Checks. This blog post is a bit technical but if you are curious (or skeptical) about our claim of generating tests for 1,000 Edit Checks in 60 seconds, this post explains how we do it.
Alternatively, you could sign up for our free webinar https://register.gotowebinar.com/register/2929700804630029324 and watch TrialGrid in action. Seeing is believing!
Before we start looking at Edit Checks let's first look at a little puzzle. Maybe you did this kind of puzzle at school.
1 2 3 4 5 6
The answer is that A can be 2, 4, 6 or 8. You probably solved this puzzle in seconds.
This kind of problem is known as a Constraint Statisfaction Problem and it is well studied in Computer Science circles. My computer solved this puzzle in 0.0007 seconds - though I helped it out a bit by telling it only to look at values for A in the range 1 to 100 since I didn't want to wait while it considered the infinite set of positive even numbers. Computers can be really good at solving these problems if the set of values to search in isn't too large.
Edit Checks are Constraint Problems
Now we've warmed up on a simple constraint problem lets look at another. This is an Edit Check that uses Systolic and Diastolic blood pressure to identify pre-hypertension:
1 2 3 4 5 6 7
In TrialGrid CQL the logic test part would look like:
1 2 3
And in Medidata Rave QuickEdit:
1 2 3 4 5 6 7 8 9 10 11
Now if we wanted to work out what values would fire this Edit Check we can formulate it as a Constraints problem using the variables SYSBP and DIABP and quickly come up with a truth table of possible values and their results:
|SYSBP||SYSBP 120..129?||DIABP||DIABP < 80?||Expected|
|122||Yes||80||No||Does not Fire|
|0||No||500||No||Does not Fire|
Okay, the last two are not likely ones you would come up with but the way we have this Edit Check formulated these are valid values. The SYSBP and DIABP Fields are defined in this study with a DataFormat of 3 which means maximum value 999 and minimum value -999. For the computer trying to solve this problem to work out which values will fire the Edit Check the constraints are:
1 2 3 4 5 6 7 8 9 10
That gives us ranges for SYSBP of (120..129) and for DIABP of (-999..79) When values are within those ranges, the Edit Check will fire. The system can also work out what values will cause the Edit Check not to fire.
Solving the Constraint Problem
So if Edit Checks are just a type of Constraint Problem, how does TrialGrid solve them?
We said already that the definition of our example edit check in TrialGrid is:
1 2 3
This format is generated automatically on import of Checks from Medidata Rave but users can also create Edit Checks using this format directly. In order to convert it to QuickEdit or back into the Architect Loader Spreadsheet format we have to parse this syntax. That turns the text into a tree-like structure in-memory:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
And by examining this tree we can generate a constraint formula by looking at the DataFormats of Fields. For numeric Fields this is simple but for other types of Field this is not too hard. Checkbox fields can only have a value of 1 or 0. Computers already store dates/times as the number of seconds since January 1 1970 and fields with Data Dictionaries are already constrained to a limited set of values (e.g. "YES", "NO", "UNKNOWN")
For any Edit Check there are likely hundreds of value combinations that will fire the check and hundreds more that will not fire the check. For now TrialGrid is set to generate a single positive and a single negative test for each Edit Check using constraints that we feel are reasonable. For example, the range of future dates is infinite but the system won't generate dates out in the year 9800.
Finding invalid Edit Checks
Medidata Rave will allow you to write Edit Checks which are valid but which will never fire. A simple example:
The SYSBP value can never be both Empty and > 100. Nobody sets out to write a check like this but in a complex Check it can happen. The constraint solver won't be able to find a solution to this problem and will fail with a warning.
Generated test case
The TrialGrid constraint solver can solve many Edit Checks and generate a positive (Check fires) and negative (Check does not fire) testcase for each in the Given..When..Then syntax.
Here is a testcase generated by TrialGrid for our example Edit Check:
TrialGrid has a batch-create option which allows you to select as many Edit Checks as you like and generate tests for them. This generally takes less than a minute for 1,000 Edit Checks.
Running tests can also be done in batch so you can take a study with no tests, generate tests and start looking at the results in about 5 minutes.
In this mini-series of blog posts we've tried to show the basics of our Automated User Acceptance Testing system. We've described what UAT is, how we format UAT tests so that they are meaningful to humans and can be executed by a computer and finally shown how the system can generate tests to get you started quickly.
That's the high level view, if you want to see this system in action please sign up for our Free Webinar on January 10 2019.
Registration at https://register.gotowebinar.com/register/2929700804630029324