Forum Discussion

payalmohitsobti's avatar
payalmohitsobti
Occasional Contributor
12 years ago

How to add http code to "Invalid HTTP Status Codes"

I am able to add invalid http status code assertion to a test request but not sure how to add code http code to the assertion using groovy

def assertion = testRunner.getTestCase().getTestStepByName("test step name").addAssertion("Invalid HTTP Status Codes")
assertion.setName("Invalid Code")

3 Replies

  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    Are you asking how to add HTTP code to the request or the assertion itself? Sorry, not really understanding the question. Could you give an example?
  • payalmohitsobti's avatar
    payalmohitsobti
    Occasional Contributor
    To the assertion.

    I would like to add an "invalid http code" assertion to a test step using groovy script.
    The groovy script does add the assertion to test request but i would like to add the code to the assertion using groovy.