Forum Discussion

naveen8944's avatar
naveen8944
Contributor
9 years ago

Need help in creating dynamic assertion

HI All   I'm in the process of creating dynamic assertions using groovy in SoapUI(Not PRO). I 'm able to add the assertion using the following successfully     def teststep = testRunner.testCase...
  • naveen8944's avatar
    9 years ago

    Found the solution after going through the API

     

    def teststep = testRunner.testCase.getTestStepByName("TestStep_Name");

    def xpathassertion = teststep.addAssertion("XPath Match")  // Adds the assertion
    xpathassertion.name = "xpath assertion"    // This is name of the assertion 
    xpathassertion.setPath("path") // This is the Xpath Expression
    xpathassertion.setExpectedContent("expected value") // As the title says..expected value

     

    Happy Coding !!