Basically I want to check via a feeder that the returned search results on a given page (where the search is created via a POST) contain the correct data, either as:
A count of rows that have a certain html attribute (i.e to tell me the expected number of results was returned)
An “exists” when a given attribute matches something (e.g. a table cell () title="" attribute contains “foo”)
A collection of table cell innertext that I can loop through
Any ideas on how to implement this using a recorder-created scenario?
1 and 2 are very easy: you just have to have an extra column for the expected result in the feeder used for setting the form params, and use a regex or css check.
Let’s say your feeder looks like this:
myFormParam,myExpectedCount
foo,3
bar,5
then, you can write a check such as css(“somethingThatSuitsYourNeeds”).count.is("${myExpectedCount}")
3 is a bit more complex. You could store in the feeder the concatenated list of expected innerTexts and concatenate in the check too with a transform step.
My bad, in 1.3, you can’t directly compare what comes from a feeder, which is a String, and a count which is an Int. You have to add a transform step such as:
css(“somethingThatSuitsYourNeeds”).count.transform(_.toString).is("${myExpectedCount}")
I’m submitting a POST with some parameters (a search query), and I seem to be getting a JSON response back from the server with the following simplified structure: