Forum Discussion

Jacob_Hassing's avatar
Jacob_Hassing
Contributor
17 years ago

script library from junit

i want to call soapui testcases from junit.
When i try that it cant find my scripts from the library.
i guess it cant find the path to the library, can i set it from junit ? or from the groovy that call my library script?
i looked at this post
http://www.eviware.com/component/option ... opic,927.0

will that work for me, if so could elaborate on solution as i do not get it 

further, is there a nice way to pass a parameter from junit to the testcase? or will i have to do a workaround write/read to a properties file ?

5 Replies

  • Hello,

    In SoapUI global settings , under soapUI Pro tab there is field Script Library set it to ${#System#script.library}. That will be rembered in soapui-settings.xml.

    Before you run test case runner you could set soapui-settings.xml and add system property
    that will set script.library value, from junit:


    public void testRunner() throws Exception
    {
    SoapUITestCaseRunner runner = new SoapUITestCaseRunner();
    runner.setProjectFile( "src/dist/sample-soapui-project.xml" );
            runner.setSettingsFile("/home/user/soapui/soapui-settings.xml");
            System.setProperty("script.library", "/home/user/soapui/myscripts");

    runner.run();
    }


    Check examples : http://www.soapui.org/userguide/command ... ional.html
    You can get testcase by its name, and its properties to set values to them before you start tescase.

    robert
  • can i reply to such an old post??

    i never got it to work and now i need it to work 
    when i set the field script library to ${#System#script.library}
    SOAPUI crashes when i restart the application.
    i dont get to see the command windows, nothing in logs.

    when i go to soapui-settings.xml and delete script library field, i can start soapui again
  • Hi,

    hmm.. what do you see in the console if you start soapUI from the command-line (ie by opening a command window, navigating to the bin folder and running soapui-pro.bat)?

    regards!

    /Ole
    eviware.com
  • Hi Jacob,

    thanks for this, it should be fixed in the upcoming nightly build.. do you want a new build right away for testing?

    regards!

    /Ole
    eviware.com