Forum Discussion

Jean-Pierre_DEL's avatar
Jean-Pierre_DEL
New Contributor
17 years ago

soapui-pro mock response sources

Hi,

I've been evaluating Soapui-pro for our organisation.

We need to run mixed SIP and WebService tests. So the idea is to run soapui from the source in a TestNG environment.

It seems to me that the test step "mock response" is not in soapui and therefore not open source ?

Thanks

Jean-Pierre

5 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    correct, the MockResponse step is not open-source. Exactly how do you plan on running your tests via TestNG?

    regards!

    /Ole
    eviware.com
  • Thanks for your answer.

    What we would like to do is the following (see Java code below), this would allow us to add some other SIP tests (SIPUnit).

    test
    public void tc08useMockResponse() throws Exception {

    println("Starting mockResponse");

    // load project and get test case
    WsdlProject project = new WsdlProject(soapuiProjSIPSnapshot);
    WsdlTestSuite testSuite = project
    .getTestSuiteByName(soapuiTestsuiteSIPSnapshot);
    WsdlTestCase testCase = testSuite
    .getTestCaseByName(soapuiTestcaseSIPSnapshotMockResponse);

    // run test case
    // Wait request
    WsdlTestCaseRunner runner = testCase.run(new PropertiesMap(), false);

    // get results
    List results = runner.getResults();

    TestStepResult res = results.get(0);

    TestStepStatus response3 = res.getStatus();

    assert response3.ordinal() == TestStepStatus.OK.ordinal();


    // SOME SIP Unit tests
    // ...
    // ...


    }



    I only managed (using mockResponse in Java) to do it by modyfying your source of :


    public WsdlTestStepRegistry() {

    addFactory(new DataSinkStepFactory());
    addFactory(new DataSourceLoopStepFactory());
    addFactory(new DataSourceStepFactory());

    addFactory(new WsdlTestRequestStepFactory());
    addFactory(new GroovyScriptStepFactory());
    addFactory(new PropertiesStepFactory());
    addFactory(new TransferValuesStepFactory());
    addFactory(new GotoStepFactory());
    addFactory(new DelayStepFactory());
    addFactory(new RunTestCaseStepFactory());

    addFactory(new WsdlMockResponseStepFactory());
    }


    In addition it seems to me not possible to access values in the result (such as the request content).

    Actually I'm not sure if that is the right way to do it but it works.
    I'm using the assertion in the "mock response" to make my test and get back the status (OK, FAILED), using XPath.



    The main idea of what we want to do with Soapui is to make data driven tests,
    having all data managed by soapui (in its xml file),and mxing then into SIP dedicated test case written in Java.

    We are a team of 10 people, we will buy a first license for further evaluation, is the license schema fully per individuals are can be aslo per site ?

    Thanks,

    Jean-Pierre
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    yes, this should work if you aren't doing any advanced scripting (ie using the script library)..

    Licenses are per individual, but can be generic if you have sporadic users (for example managers, etc.). We do not have any site-licenses at this time, but have very generous volume discounts (check out our purchase page for details; http://www.eviware.com/component/option ... Itemid,37/)

    regards!

    /Ole
    eviware.com
  • Question 1 :
    Does this means that there is no support for groovy script for "mock response" when doing this way ?
    It is working in soapui-pro, but I cannot make it work from my source code.

    Question 2 :
    Would it be possible to have a public interface for the "mock response" result ?
    It could be useful to get data received from the request in the testcase.

    Thanks,

    Jean-Pierre
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi,

    1) no, you can get full functionality from within your tests, but you will have to initialize the soapUI Pro core correctly

    2) the WsdlMockResponseTestStep has a public getMockResponse() method, which should let you drill down to the last received result..

    regards!

    /Ole
    eviware.com