Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Testcase iteration for assertion validation

Teja
Teja Posts: 10

Hi all,

Using scripting how to iterate the testcase for performing validations for Assertion for error codes , my requirement is I would be creating a custom assertion code using groovy where it will be fetching the errors codes from writable datasource ( where we will be storing 10-20 api error codes) .
Now once the rest client is gets excuted it should check the response if it have any error code then the groovy code must compare with the datasource error code and iterate for the next datasource row error code to compare with api response.

Answers

  • whaaker
    whaaker Posts: 61

    The Misc tab of the REST Client has a field for defining valid HTTP response codes from the service response and can be parameterized to your data source that contains a column with the rows of expected error status codes from the API response. I would look into using that feature to have your test client iterate through each row and verify the response code is what you expect.

  • benken_parasoft
    benken_parasoft Posts: 1,352 ✭✭✭