Hi,
I do this all the time. But, as Humashankar wrote you have options...
Firstly where?
- SmartAssertion : You could add a SmartAssertion to the test step. Whilst I haven't used this in anger, in the cell of interest in Valid Value, right-click. From the context menu, select Get Data. You should now have additional context menus that allows you to navigate to you test and the datasource step.
- Script Assertion : You could apply a Script Assertion to the test step. See later...
- Groovy Script Step : In the past I've added a Groovy step after the test request step. From here, I can access the test step and the data source and assert as I see fit.
- Datasink and Groovy Scripts : The above are great for rapid feedback to spot a failure. However, there is a price. If you have a long running data-driven test, the whole test stops and fails on the first failed assertion. This can be really frustrating. For long running tests, use a different approach. I create a Groovy Step that returns a PASS/FAIL string (more later). In the Datasink step, I call the Groovy script step and the datasink saves the Pass/Fail in a CSV. Once the test has finsihed, I load the CSV into Excel and I can see all my failures.
Script Assertion Open the test step of interest, near the bottom of the screen there will be an Assertion tab. Use the + to create a Script Assertion. In the Add Assertion window, select Script.
In the empty window, you can then write the script. Here, the Get Data functionality is your best mate. Use it to get the datasource value of interest and then get the value from test step and use assert to compare the two E.g.
def datasourceCustomerName = context.expand( '${CustomerDataSource#CustomerName}' );
def responseCustomerName = context.expand( '${Some REST Test Request#Response#declare namespace ns1=\'urn:some.domain:msrefdata:domain:1\';
assert datasourceCustomerName.contains(responseCustomerName);
Groovy Script Create a Groovy step after your test request. As with the Script Assertion, use get data to create the datasource value variable and the response value and compare. It will look almost identical to the above.
Datasink and groovy Sorry, this will take a bit longer to explain, so I'll leave my response here. If you're interest in this approach, then I'll take the time to explain in detail.