Forum Discussion

chimas's avatar
chimas
Occasional Contributor
10 years ago

From Project teardown script can I access the status, timetaken of TestSuite and TestCase?

I'm trying to access from a Project teardown the result of the test execution.

 

Inside this project I have 2 Test Suites. One with 2 testCases and one with 1 testCase

 

Projects.jpg

 

The goal is to build an email with the Project result inside the body (nothing attached)

 

NAME

DETAILS

RESULT

PROJECT

 

FAIL

-TestSuite 1

Response time = 3904 ms

PASS

--TestCase 1

Response time = 1589 ms

PASS

--TestCase 1.1

Response time = 2315 ms

PASS

-TestSuite 2

Response time = 717 ms

FAIL

--TestCase 2

Response time = 717 ms

FAIL

 

I tried runner, context but without success.

 

Can someone help me with it?

 

Thanks,

Rodrigo Petry

 

  • kondasamy's avatar
    kondasamy
    Regular Contributor

    Radrigo,

     

    I guess you requirement is similar to generating a Project level - JUnit style reporting through SoapUI's inbuilt option as mentioned in the below screen shot, (If it is convinient for you, please make use of this option as it gives more than expected)

     

    2015-10-21_10-15-50.png

     

    To match your requirement, I experimented with below script and couldn't find the expected result with just looping through the runner results , (Sharing in this forum as others might find some clues) :smileyhappy:

    for( projectResult in runner.results)
    {
    	log.info "Project name : " + projectResult.getProject().name
    	log.info "Project status : " + projectResult.getStatus().toString()
    	for ( testSuiteResult in projectResult.results )
    	{
    		log.info "Test suite name : " + testSuiteResult.getTestSuite().name
    		log.info "Test suite status : " + testSuiteResult.getStatus().toString()
    		for ( testCaseResult in testSuiteResult.getResults() )
    		{
    			log.info "Test case name : " + testCaseResult.getTestCase().name
    			log.info "Test case status : " + testCaseResult.getStatus().toString()
    		}
    	}
    }

    Thanks,

    Samy

    • chimas's avatar
      chimas
      Occasional Contributor

      Thank you Samy

       

      I think this option of Junit style report can solve my problem.

       

      But do you know if I can call the generation of this Junit report inside Project Teardown script?

       

      So in that way I can open this file inside the Teardown and add it to the body of the email, not as attachment.

       

      For my original question I found a solution saving one file with html code on the project path and incrementing the results on each TestSuite - TearDown end on the Project - TearDown I'm opening that file and populating the body of the email with the content of this file.