Ask a Question

How to implement logic at testsuite level ?

SOLVED
krogold
Regular Contributor

How to implement logic at testsuite level ?

Hello,

 

Is there any way to implement logic at testSuite level ?

What I'm trying to achieve is to implement setup or teardown scripts feature that would apply on every testCase of my testSuite.

Of course, these scripts would include variables that would take values according to the current running test case ...

 

If anyone knows ...

So far I tried to do this in setup script and it failed with a

groovy.lang.MissingPropertyException: No such property: testRunner for class: Script1

message. 

Maybe SOAP ui could be configured ?

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
krogold
Regular Contributor

Re: How to implement logic at testsuite level ?

After further investigation, I managed to do a complete summary of my tests, test cases and test steps, in my testSuite teardown script:

def runner = context.testRunner;

for (testRun in runner.getResults())
{
	testCase = testRun.getTestCase()
	//log.info "testCase " + testCase
	log.info context.expand( '${#Project#testcase_flag}' ) + testCase.getName()

	for (testResult in  testRun.getResults())
		log.info testResult.getTestStep().getName() + " : " + testResult.getStatus()
	
	log.info context.expand( '${#Project#testcase_status_flag}' ) + " : " + runner.getStatus()
}

View solution in original post

2 REPLIES 2
krogold
Regular Contributor

Re: How to implement logic at testsuite level ?

So far, it is possible to implement something in the teardown script :

ie, I want a summary of execution for my testCases :

for (testCase in context.testRunner.getResults())
{
	log.info  testCase.getTestCase().getName() + " : " + testCase.getStatus()
}

this provides me with information <testcase> : <status>

 

If someone has other methods or manages to do things in setupscript, don't hesitate to post !  🙂

krogold
Regular Contributor

Re: How to implement logic at testsuite level ?

After further investigation, I managed to do a complete summary of my tests, test cases and test steps, in my testSuite teardown script:

def runner = context.testRunner;

for (testRun in runner.getResults())
{
	testCase = testRun.getTestCase()
	//log.info "testCase " + testCase
	log.info context.expand( '${#Project#testcase_flag}' ) + testCase.getName()

	for (testResult in  testRun.getResults())
		log.info testResult.getTestStep().getName() + " : " + testResult.getStatus()
	
	log.info context.expand( '${#Project#testcase_status_flag}' ) + " : " + runner.getStatus()
}

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: