RE: SoapUI NG Pro Count No. Of Test Cases
Hello,
I just want to know how to count the total number of test cases inside my Project. I have certain condition to apply on this.
1. The disabled/reusable TestSuites/Test Cases Should be omitted from this count.
2. If any of the Test Cases involves with DataSource/DataSourceLoop Test Steps, then I need to count the total number of rows inside the DataSource as Test Case Count. I dont want to count the entire Datasource/loop as a single test case.
I have the following script to achieve the Task 1. But want to know how to achieve the Task 2.
def totalTestSuiteCount = 0;
def enabledTestSuiteCount = 0;
def disabledTestSuiteCount = 0;
totalTestSuiteCount = testRunner.testCase.testSuite.project.getTestSuiteCount();
for(i = 0; i < totalTestSuiteCount; i++) {
flag = testRunner.testCase.testSuite.project.getTestSuiteAt(i).isDisabled();
if(!flag)
enabledTestSuiteCount = enabledTestSuiteCount + 1;
else
disabledTestSuiteCount = disabledTestSuiteCount + 1;
}
log.info "Total Test Suite Count : " + totalTestSuiteCount;
log.info "Total Enabled/Active Test Suite Count : " + enabledTestSuiteCount;
log.info "Total Disabled/Reusable Test Suite Count : " + disabledTestSuiteCount;
def totalTestCaseCount = 0;
def enabledTestCaseCount = 0;
def disabledTestCaseCount = 0;
for(i = 0; i < totalTestSuiteCount; i++) {
flag = testRunner.testCase.testSuite.project.getTestSuiteAt(i).isDisabled();
if(!flag) {
totalTestCaseCount = totalTestCaseCount + testRunner.testCase.testSuite.project.getTestSuiteAt(i).getTestCaseCount();
}
}
for(i = 0; i < totalTestSuiteCount; i++) {
flag = testRunner.testCase.testSuite.project.getTestSuiteAt(i).isDisabled();
if(!flag) {
tccount = testRunner.testCase.testSuite.project.getTestSuiteAt(i).getTestCaseCount();
for(j = 0; j < tccount; j++) {
tcflag = testRunner.testCase.testSuite.project.getTestSuiteAt(i).getTestCaseAt(j).isDisabled();
if(!tcflag)
enabledTestCaseCount = enabledTestCaseCount + 1;
else
disabledTestCaseCount = disabledTestCaseCount + 1;
}
}
}
log.info "Total Test Case Count : " + totalTestCaseCount;
log.info "Total Enabled/Active Test Case Count : " + enabledTestCaseCount;
log.info "Total Disabled/Reusable Test Case Count : " + disabledTestCaseCount;