TestPlan An example using Google
Document

An example using Google

by Group Public on Tuesday June 24 2008 @ 21:00:43 (-9/-9 Points)

Example ↪User Guide ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It

As a quick example, the below uses the calculation function of Google to compute a simple arithmetic statement.

GotoURL http://www.google.com/
Notice %Response://form[@name='f']/@action%

SubmitForm with
  %Params% with
    %q% 4 + 5
  end
end

Check //b[contains(string(),'4 + 5 = 9')]

Details

GotoURL http://www.google.com/

GotoURL should be clear enough: here we simply go to the Google website.

Notice %Response://form[@name='f']/@action%

Notices are simply a way to report information back to whoever is running the test. This one extracts information from the response using XPath: it provides the name of the action parameter in the form.

SubmitForm with
  %Params% with
    %q% 4 + 5
  end
end

SubmitForm types values into a form and submits them. This is its simplest form, obviously for pages with multiple forms there are options to specify which one. Also, for pages with interactive forms there is a similar UpdateForm which allows modifications without submission.

Check //b[contains(string(),'4 + 5 = 9')]

Most of the functions of TestPlan have implicit checking in them, such as response codes and form parameters, but a lot of your code will need to do explicit checks. This Check above is a simple XPath check, which ensures Google has given us the exact response we expect.

© 2008-2010 edA-qa mort-ora-y
Using Persephone and TestPlan
Tag: