Forum Discussion

Buschfunk's avatar
Buschfunk
Frequent Contributor
13 years ago

Get all test suite's test case results

Hello,

I need to do the following but I don't know how to

Description
Using soapUI Pro 4.5 I have two test suites "TestSuite_A" and "TestSuite_B" with several test cases. Both of them are run independent from each other. After both test suites are finished I'd like to export the results to a file using a Groovy script, i.e. I cannot use the testRunner object.

Basically I need to do the following: Go through all test cases in each test suite and get the result ("FINISHED" or "FAILED").

How can I do this using Groovy?

4 Replies

  • Buschfunk's avatar
    Buschfunk
    Frequent Contributor
    Henrik,

    Thanks for the link. However I'm afraid that this won't work for my case. Here's some more information.

    Initial situation
    There are two test suites: TS_A, TS_B. Each of them contains around 20 test cases. Usually we don't execute complete test suites or even the complete project but single test cases as there is some manual work to do between executing the tests. After having executed all necessary test cases I want to manually start a Groovy script "getTestCaseResults" which collects all the results of each single test case. I don't want to get the results of all the test steps, just the test case result "FINISHED" or "FAILED". It is ok that test cases may appear which have not been run and thus don't have a result.

    Given this information I cannot use a teardown script of a test case or a test suite. What I basically need is:


    • Iterate over all test cases (I already have that)

    • Get the test result of each test case


    Iterating was achieved by using a code snippet like that:

    testRunner.testCase.testSuite.project.getTestSuiteList().each {
    it.getTestCaseList().each {
    // Need something like:
    // it.getResult()
    }
    }

    However I cannot find a method which can be applied for getting the result.

    Sincerely,
    Robert
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    in each test case tear down script you can set property with result of this testCase:
     def tc = runner.testSuite;

    for ( testCaseResult in runner.results )
    {
    tc.setPropertyValue("result",testCaseResult.getStatus().toString())
    if (testCaseResult.getStatus().toString() == "FAILED") {
    break;
    }

    }


    and then in groovy script you can iterate over this testCase properties:

    testRunner.testCase.testSuite.project.getTestSuiteList().each {
    it.getTestCaseList().each {
    println it.getPropertyValue("result")
    }
    }
  • RJanecek's avatar
    RJanecek
    Regular Contributor
    probably you should in setup script set these testCase property to null or empty string...