Contributions
Re: Getting Assertion Renaming Box while adding Script assertion using Groovy Script. How to avoid it?
Hi Chris, I tried the way you suggested, but it is not creating the assertion in the test step as expected, and in the next step getting he below error "Cannot invoke method setScriptText() on null object"1.2KViews0likes2CommentsGetting Assertion Renaming Box while adding Script assertion using Groovy Script. How to avoid it?
I need to add a Script Assertion using the Groovy Script. When I tried the below piece of code I am getting the assertion renaming box as displayed in the screenshot. How to avoid it? // Get the SOAP test step. def testStep = context.getTestCase().getTestStepByName('TestStepforScript') // Just create a unique name each time, allows the script to be run // multiple times without clashing assertion names. def currentDateTime = new Date() def newAssertionName = currentDateTime.format("HHmmss") log.info('newAssertionName = ' + newAssertionName) // Add the new script assertion. def testAssertion = testStep.addAssertion('Script Assertion') testAssertion.setName(newAssertionName) testAssertion.setScriptText("log.info 'we are running the script assertion ${newAssertionName}'")Solved1.2KViews0likes4Comments