Forum Discussion

msimmerson's avatar
msimmerson
Occasional Contributor
14 years ago

[Reolved] Calling external Test Suites

Hi

I am using SOAP UI Pro 4.0.1.

I have a bunch of projects in a workspace, each with their own Test Suite(s).

What I want to be able to do is create another project that will be able to run all the other project's Test Suites from this new project.

Is this possible? and if so how do I do it?.

Cheers

Matt

2 Replies

  • msimmerson's avatar
    msimmerson
    Occasional Contributor
    Hi

    Ok, so I sorted this myself and here is the Groovy Script to do it.
    Basically, the code gets a handle to the workspace which then has access to all the projects in the workspace. Each project then navigates its way through every test suite and test case that belongs to that project.

    Simple when you know how!!!

    Cheers

    Matt

    def projectWS = project.workspace
    def projectList = projectWS.projectList
    def errorCount = 0;

    for (int i = 0; i < projectList.size; i++) {
    if (!projectList.path.contains("UnitTests")) {
    def testSuiteList = projectList.testSuiteList
    for (int j = 0; j < projectList.testSuiteCount; j++) {
    def testCaseList = testSuiteList[j].testCaseList
    log.info("Running Test Cases for " << testSuiteList[j].label)
    for (int k = 0; k < testSuiteList[j].testCaseCount; k++) {
    def testCaseRunner = testCaseList[k].run(context, false)
    if (testCaseRunner.status != testCaseRunner.status.valueOf("FINISHED")) {
    log.error("Test Case " << testSuiteList[j].label << ":" << testCaseList[k].label << " FAILED. Status was:" << testCaseRunner.status)
    errorCount++;
    }
    }
    }
    }
    }

    if (errorCount == 0) {
    log.info("All Tests PASSED");
    } else {
    log.info("" << errorCount << " tests FAILED");
    }