ServiceTest 11 (ST) complex data type checkpoint
Question ID: 104378
0
0

In a Checkpoint, is there a way to map the expected result of a complex data type (one where n number of values can be returned) to a Data source (excel, database, xml)? It appears that only Available steps and Test variables are the only options available in the Select Link Source window.

For example, depending on the data at the time of test, a variable number of books can be returned:

<books>  
  <title>Now You See Her</title>  
  <author>James Patterson</author>  
</books>  
<books>  
  <title>The Thank You Economy</title>  
  <author>Gary Vaynerchuk</author>  
</books>

Marked as spam
Posted by (Questions: 3, Answers: 4)
Asked on June 30, 2011 4:15 pm
92 views
Answers (1)
2
Private answer

I structured the test in the following way, which is different than how I was trying to structure it...
[Script Flow][1]

What you do not see in the Test Flow is that I created a database data source. So the expected results (data in the database) is queried at runtime.

In the Property Sheet of the Test Flow, the Input, select 'For Each' Loop option. Then in the Loop for each item in: field, select link to source. The Data source column option should be selected, then expand the tree and select the data source name.
[Flow Loop][2]

To extract the first element from the web service response, I store it in a variable first to make it easier to use it in later steps. But the trick to make it iterate through response is join the output tag with the current iteration of the for loop in the Test Flow.
[Response Tag][3]

Now add a condition statement to compare the DB value to the WS value. Since the Flow Loop is driven by the DB data source, the variable for the conditional statement should use the db as well. The Value is linked to the variable created from the web service response. [Condition][4]

The result is a script that will handle a variable number of records in the database and a variable number of values from the web service. The example in the solution here is only for one value in the response. But it could be easily expand to handle the example posted in the original question

[1]: http://img233.imageshack.us/img233/6846/flowc.png ''ST Flow''
[2]: http://img580.imageshack.us/img580/6412/testflowloop.png
[3]: http://img7.imageshack.us/img7/5276/responsetag.png
[4]: http://img684.imageshack.us/img684/65/conditionalstatement.png

Marked as spam
Posted by (Questions: 3, Answers: 4)
Answered on July 5, 2011 6:38 pm
0
Brilliant.
( at July 14, 2011 8:26 am)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top