In this example, I am going to use a success criteria to monitor a specific field value for a given response, but there are many possible ways to implement continuous testing. To have a little fun, I am going to use a JSON weather services provided by http://api.openweathermap.org. Being the weather and this being Canada, there should be a lot of change.
Lets say you only interested in knowing if Rain is in the forecast for the next day. Lets set up a success criteria first that fails the test case should there be rain in the forecast. if you not done the introductory tutorial on Success Criteria please do so first.
1. File, New, Test Group. New JSON Test and Name it. Paste the following in the URI
and Set the method to GET. Commit and Send.
2. Now All we want to know is if there is rain in the the forecast. Select Success Criteria tab, Add Criteria Rule and XPath Match.
3. Now lets edit our XPath Match rule. By selecting it, we see the Graphical XPath, Scroll down till you see weather, main and select the value, right-click and Compare Element Value.
4. Select tab Criteria Rules. Change the Force Action to Force Fail. and Match Function term to Rain. We now have a criteria rule that will fail the test case if rain is in the forecast. Drag it over to the Run View and Send. Did it fail? is there Rain in the forecast?
5. Now if we automate the test case and it fails, it should mean rain. So in Run View, select Create Command Line Script. (see pointer). you need to save the file first.
6. Now Lets Generate a Report, (One Page), call it rain and Email Report to the right address. We then need to define our email SMTP settings. On the second page, fill in the details for your email server and send test email.
7. Lastly, let schedule as a a Task using the Windows Scheduler. Fill in details and OK. If you want, you can go into windows scheduler to edit the task further. The test case uses standard windows scheduler. On manually running it, I get a PDF report in my mailbox as an attachment.
8. Note, I could also set up a Task in the response section to send me a email with some personalized note.
This rather silly example is to show that you can automate a test case to run as frequently as you may want, to watch for a certain value in a certain part of the response, that you defined as a success criteria. That could well be a response time, validation code or any other parameter, and need not be rain.
Questions, or Comments?