cancel
Showing results for 
Search instead for 
Did you mean: 

Can I check assertion status for groovy teststep

MadSaid
Contributor

Can I check assertion status for groovy teststep

Hi,

I would like to check the assertionStatus of a groovy testStep, cause I have some assertions there. I need this for reporting.

E.g. below statements works very well on teststeps that are instanceof com.eviware.soapui.model.testsuite.Assertable

 

log.info testRunner.testCase.testSteps["myTeststepName"].assertionStatus

 

In my case the groovy testStep is NOT Assertable. How to do this then?

Thanks in advance!

6 REPLIES 6
nmrao
Community Hero

Re: Can I check assertion status for groovy teststep

What is the use case?

If assertion fails the step fails, Isn't it?



Regards,
Rao.
MadSaid
Contributor

Re: Can I check assertion status for groovy teststep

Thanks for your response... Below is a (simplified) structure of my test case. 

TestCase
	Init Groovy
	DataSource
		Soap Call1
		Groovy TestStep
		Set TestResult (DataGen)
		Save TestResult (DateSync)
	DataSource Loop

use case: I have a DataSource Loop processing a few hunderd rows. I need to report pass / fail for each row. In the step  Set TestResult (DataGen) I have this statement:

return testRunner.testCase.testSteps["Soap Call1"].assertionStatus

With this I know if the current row passed or failed. 

I have some assertions in the Groovy TestStep. I also would like to know per row if any of the assertions in that step failed. This is needed for the reporting that I am doing in the step Save TestResult (DateSync).

Hope you can advise on the best way to do this.

Thanks in advance!

sonya_m
Community Manager

Re: Can I check assertion status for groovy teststep

Thank you for explaining your use case.

 

@nmrao , any suggestions for this? Thank youSmiley Happy


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
nmrao
Community Hero

Re: Can I check assertion status for groovy teststep

So do you run the same code for Groovy step?
<code>
return testRunner.testCase.testSteps["Groovy TestStep"].assertionStatus
<code>

What happens if groovy script fails or passes currently ?


Regards,
Rao.
TanyaYatskovska
Community Manager

Re: Can I check assertion status for groovy teststep

Thanks for the help, @nmrao,

 

@MadSaid, was the issue resolved? Please share the solution you decided to use.

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
MadSaid
Contributor

Re: Can I check assertion status for groovy teststep


@nmrao wrote:
So do you run the same code for Groovy step?
<code>
return testRunner.testCase.testSteps["Groovy TestStep"].assertionStatus
<code>

What happens if groovy script fails or passes currently ?


When I run the statement

return testRunner.testCase.testSteps["Groovy TestStep"].assertionStatus

on a groovy test step I get error below

 

No such property: assertionStatus for class: com.eviware.soapui.impl.wsdl.teststeps.DebuggableWsdlGroovyScriptTestStep

That is why I need some other way to check if scrip passed or failed

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors