15 years ago
TestRunner logging
I've got a test suite, which consists of one test case, which is being cloned with this script:
This script is a test suite setup script. What it does is it takes the only currently existing test case in the suite and clones it to create ~350 more test cases.
When I run the test suite from soapUI, it seems to work fine (first the test suite is being populated with all the 350 test cases, which are created by the setup script, then all of them are being run), but when I try to run this suite from the terminal with testrunner.bat with JUnit reports, it produces no log. The log I'm getting is the following:
I'll appreciate if anyone could point to what am I doing wrong and how to make TestRunner produce logs for every test case, created by the script.
Thanks!
import java.util.*;
import com.eviware.soapui.support.*;
import com.eviware.soapui.impl.wsdl.*;
def groovyUtils = new GroovyUtils(context);
def csvpath = groovyUtils.projectPath + "\\attacks_dict.csv"; //Define relative CSV path
BufferedReader input = new BufferedReader(new FileReader(new File(csvpath).getAbsoluteFile())); //Read the CSV file
String[] rows = input.text.split('\r\n'); //Line separator
for(int i = 0; i < rows.size(); i++){
def template = "TestCase";
def counter = i + 1;
def tsname = template + counter;
context.getTestSuite().cloneTestCase(context.getTestSuite().getTestCaseByName("TestCase"), tsname);
context.getTestSuite().getTestCaseByName(tsname).setDisabled(false);
context.getTestSuite().getTestCaseByName(tsname).getTestStepByName("TestCase").setDisabled(false);
String string = rows[i];
String contains = "CDATA";
//If string contains "CDATA", do not append CDATA tags to it
if (string.indexOf(contains) != -1) {
context.getTestSuite().setPropertyValue("data", string); //Write each line into a test suite property
//Else append CDATA tags to the string
} else {
data = "<![CDATA[" + string + "]]>";
context.getTestSuite().setPropertyValue("data", data); //Write each line into a test suite property
}
context.getTestSuite().setPropertyValue("lineno", Integer.toString(i)); //Convert lineno property value to string
//context.getTestSuite().testCases[tsname].run(new com.eviware.soapui.support.types.StringToObjectMap(), false); //Run test case
}
input.close();
This script is a test suite setup script. What it does is it takes the only currently existing test case in the suite and clones it to create ~350 more test cases.
When I run the test suite from soapUI, it seems to work fine (first the test suite is being populated with all the 350 test cases, which are created by the setup script, then all of them are being run), but when I try to run this suite from the terminal with testrunner.bat with JUnit reports, it produces no log. The log I'm getting is the following:
Running soapUI TestRunner for [project]
directory: C:\Program Files\eviware\soapUI-3.5.1\bin\.
command: cmd.exe /C testrunner.bat -sTestSuite -r -j D:\Projects\project\local_test_run\tests\service\project\project.xml
soapUI 3.5.1 TestCase Runner
Configuring log4j from [C:\Program Files\eviware\soapUI-3.5.1\bin\soapui-log4j.xml]
16:19:50,158 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Documents and Settings\me\soapui-settings.xml]
16:19:50,861 INFO [WsdlProject] Loaded project from [file:D:/Projects/project/local_test_run/tests/prj/project/project.xml]
16:19:51,705 INFO [SoapUITestCaseRunner] Running soapUI tests in project [project]
16:19:51,705 INFO [SoapUITestCaseRunner] Running TestSuite [TestSuite], runType = SEQUENTIAL
16:19:54,533 INFO [SoapUITestCaseRunner] TestSuite [TestSuite] finished with status [FINISHED] in 2812ms
SoapUI 3.5.1 TestCaseRunner Summary
-----------------------------
Time Taken: 2821ms
Total TestSuites: 1
Total TestCases: 0 (0 failed)
Total TestSteps: 0
Total Request Assertions: 0
Total Failed Assertions: 0
Total Exported Results: 0
I'll appreciate if anyone could point to what am I doing wrong and how to make TestRunner produce logs for every test case, created by the script.
Thanks!