Forum Discussion

vijayevol's avatar
vijayevol
Occasional Contributor
15 years ago

Needs to execute a range of test cases.

I want to execute selected test cases within a test suite. For example, I have a test suite that contains 100 test cases numbers from 1 to 100 and I only want to execute test cases from 25 to 40. Is it possible using soapui testing tool? If possible, which version supports this functionality. Please reply, thanks in advance.

5 Replies

  • Select test cases 1-24, right click -> Disable.
    Select test cases 41-100, right click -> Disable.
    Run Test Suite.
  • And if you want to do this programmatically, you could use groovy Setup Script to disable test steps M thru N, where M and N could be custom variables in the project, even passed in via testrunner -P arguments.
  • Put the following code into the "Setup Script" of a Test Suite.
    The following code takes #Project# level properties 'A' and 'B' and disables Test Cases where the Test Case number (in order of execution) is less than A or greater than B.
    A and B are zero-indexed, that is a value of "0" (zero) means the first Test Case in the TestSuite.
    If either A or B do not exist, or are empty properties, then all test cases will be enabled.



    def (A,B) = ['','']; // Initially assign each an empty string.
    A = context.expand( '${#Project#A}' ) //Run this test case (zero-indexed)
    B = context.expand( '${#Project#B}' ) //Through this test case (zero-indexed)

    // If A or B is empty then enable all test cases and return
    if ( A == '' || B == '' ) {
    log.warn 'One of A,B not set. All test cases will be enabled.'
    testSuite.testCaseList.each { it.disabled = false }
    return 0
    }

    A = A.toInteger(); B = B.toInteger() //convert to integer

    log.info 'Total number of TestCases in TestSuite[' + testSuite.label + ']: ' + testSuite.testCaseCount

    lastCase = testSuite.testCaseCount - 1 //get index of last test case (zero-indexed)
    log.info 'A=='+A+' B=='+B+' Disabling test cases 0-' + (A-1) + ' and ' + (B+1) + '-' + lastCase
    for ( i in ((0..lastCase)-(A..B)) ) { //disable all test cases before A and after B
    def testCase = testSuite.getTestCaseAt(i)
    testCase.disabled = true
    if ( testCase.disabled == true ) log.info 'Disabled test cast ' + i + ' (' + testCase.label + ')'
    }