Forum Discussion

_ivanovich_'s avatar
_ivanovich_
Frequent Contributor
4 years ago

How to run testsuite with java?

Hi,

i want to run soapui testsuite with java.

i have soapui-5.6.0 open source.

in Eclipse i created a project.

with JRE1.8

Then i added all jars from lib into the java project and also this one soapui-5.6.0.jar

It looks there is a problem with groovy-all-2.4.17.jar

1-Should i use an older version of soapui for all jars?

2-Should i replace the groovy-all-2.4.17.jar by another version?

3-Is it correct to use the soapui open source jars here? or is it working only with pro version?

 

Thank you

 

 

 

It throws this error:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/Program%20Files/SmartBear/SoapUI-5.6.0/lib/groovy-all-2.4.17.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

 

i have this code in java:

import java.util.List;
import org.junit.Test;
import com.eviware.soapui.impl.wsdl.WsdlProject;
import com.eviware.soapui.model.support.PropertiesMap;
import com.eviware.soapui.model.testsuite.TestCase;
import com.eviware.soapui.model.testsuite.TestRunner;
import com.eviware.soapui.model.testsuite.TestSuite;
import com.eviware.soapui.model.testsuite.TestRunner.Status;
import com.eviware.soapui.tools.SoapUITestCaseRunner;
import static org.junit.Assert.*;

public class SoapUITest {

test
public void lessControl() throws Exception {
SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
runner.setProjectFile("C:\\temp\\test.xml");
runner.setPrintReport(true);
runner.run();
}

test
public void fullControl() throws Exception {
WsdlProject project = new WsdlProject("C:\\temp\\test.xml");
List<TestSuite> testSuites = project.getTestSuiteList();
for( TestSuite suite : testSuites ) {
List<TestCase> testCases = suite.getTestCaseList();
for( TestCase testCase : testCases ) {
System.out.println("Running SoapUI test [" + testCase.getName() + "]");
TestRunner runner2 = testCase.run(new PropertiesMap(), false);
assertEquals(Status.FINISHED, runner2.getStatus());
}
}
}
}

6 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    I believe any one looks for the simple way to run the tests. Hope you agree this.

    SoapUI provides a utility, testrunner.bat (.sh) under SOAPUI_HOME/bin directory.

    If you open that file in a text file, you can see it is calling a Java class.

    So I would suggest to execute your project using this command line. This is more optimum than opening an eclipse (which itself need lot of memory) and create a project, write code to execute the SoapUI project. To do this one needs to be expert/ familiar in eclipse tool.
    Why to spend this much of efforts, which aren't required, while the simple command would do the same job?

    Of course, it is not that it is possible.
  • nmrao's avatar
    nmrao
    Champion Level 3
    You can look for SoapUI documentation of command line options for testrunner.
  • nmrao's avatar
    nmrao
    Champion Level 3
    If it some kind of mandatory to execute the tests in this particular way only which why you are using eclipse ?
    • _ivanovich_'s avatar
      _ivanovich_
      Frequent Contributor

      Of course it works with command line too.

      With project in Eclipse or Intellij idea or Netbeans or any other ide i can integrate the code easily with my team.

      • nmrao's avatar
        nmrao
        Champion Level 3
        Not sure I understand.

        Is the above for QA team? Do they use IDE's? and write the above code?