Ask a Question

Issue while Running SOAPUI xml from Java in a container like Jboss Server

Sonalee
Occasional Contributor

Issue while Running SOAPUI xml from Java in a container like Jboss Server

I am trying to run the SOAP UI project xml from the Java end and that  java project  is a web application  that has been deployed in Jboss server. The SOAPUI xml is running for the first time and report is generating but the server is getting hanged after that .. and also it is not allowing to do any successive run . I am closing the SOAPUI Thread also completely. Please find the code snippet which I have written for this.

 

//SOAPUI xml file path set here
            runner.setProjectFile((String) detail.get("testcasepath"));
            runner.setOutputFolder(filePath + timeStamp);

            // Executing the xml and generating the report
            runner.setJUnitReport(true);
            runner.setPrintReport(true);

            try {
                LOGGER.error("Run Started");
                runner.run();

            } catch (Exception e1) {

                System.out.println("Execution failed due to : ");
                e1.printStackTrace();
            }

        }

        // Need to shutdown all the threads invoked by each SoapUI TestSuite
        SoapUI.getThreadPool().shutdown();
        try {
            SoapUI.getThreadPool().awaitTermination(1, TimeUnit.MINUTES);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // Now to shutdown the monitor thread setup by SoapUI
        Thread[] tarray = new Thread[Thread.activeCount()];
        Thread.enumerate(tarray);
        for (Thread t : tarray) {
            if (t instanceof SoapUIMultiThreadedHttpConnectionManager.IdleConnectionMonitorThread) {
                ((SoapUIMultiThreadedHttpConnectionManager.IdleConnectionMonitorThread) t)
                        .shutdown();
            }

        }

        // Finally Shutdown SoapUI itself.
        SoapUI.shutdown();

 

11 REPLIES 11
nmrao
Champion Level 3

Please see if the code snippets provided in the below documentation link helps to resolve the issue:

https://www.soapui.org/test-automation/junit/junit-integration.html


Regards,
Rao.
Sonalee
Occasional Contributor

Hi  Rao,

 

Thanks for your quick  reply . The link  which  you  have provided I have gone through  this.  I have written  the similar piece of code to  run the  xml  .

 

SoapUITestCaseRunner runner = new SoapUITestCaseRunner();

            // Set xml path
            runner.setProjectFile((String) detail.get("testcasepath"));

            // Set output folder
            runner.setOutputFolder(filePath + timeStamp);

            // Executing the xml and generating the report
            runner.setJUnitReport(true);
            runner.setPrintReport(true);

            try {
                LOGGER.error("Run Started");
                runner.run();

            } catch (Exception e1) {

                LOGGER.error("Execution failed due to : ");
                e1.printStackTrace();
            }

 

But the issue  here is the test  cases is running fine when running from a standalone program but  while invoking the same program from a webapplication  the  JBOSS server is getting stuck  at that  point.  Server is not  responding no more.We need to  restart  the server again to  respond as usual.

nmrao
Champion Level 3

test case runner can be run, of course, as standalone program either from command line etc.

What is the relationship with jboss (hope your service might be running there)?


Regards,
Rao.
Sonalee
Occasional Contributor

Hi  Rao,

 

Thanks again  for your quick  reply . I am really  struggling to  fix this issue.

 

 

I have a web application UI   . My  requirement  is from my  application  I need to  select  the SOAPUI  xml  path  which  is present in my  server  static path   and then  when I will  click  one button (eg Run) from  my  UI  .. It should execute that  SOAPUI  xml  and generate the result  report  in the server path .

 

So  when I am running this from my  UI  the server is getting stuck .

 

A quick  response is highly  appreciated.

 

 

nmrao
Champion Level 3

Are you running any web testing using SoapUI?


Regards,
Rao.
Sonalee
Occasional Contributor

We are executing SOAPUI  XML  (which  contains the rest services test cases )   from another webaplication for automation testing.

nmrao
Champion Level 3

Ok. thank you for clarifying.

Is it that you wrote a program (which execute the soapui project), created a library and deployed in jboss?

If so, not sure why to complicate things while can be executed easily using SOAPUI_HOME/bin/testrunner utility or running from CI tools such as Jenkins.


Regards,
Rao.
Sonalee
Occasional Contributor

Hi  Rao,

 

Thanks for your patience.  I really  appreciate for your help . 

 

You  are correct . I  have  written a program (which execute the soapui project), created a library and deployed in jboss. As you  mentioned I have tried by  using the testRunner.bat  and also  from CI  like JEnkins .It is working fine.

 

But here we are developing one framework  which  will  execute any  type of test cases like SOAPUI or  SELENIUM  type ..Our requirement  is to  execute that  framework  form  the server ..Thats why  I am using like this.

 

 

Hope my  explanation clarify  your question .

 

 

nmrao
Champion Level 3

Ok, got it.

May be I am missing more context.

The web application / framework(that you are talking) accepts various parameters to execute the soapui project?

Is soapui project is being run in a separate thread?


Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: