Forum Discussion

smartapi's avatar
smartapi
Occasional Contributor
10 years ago

How to create a scenario test

In SoupUI (non pro version), there are two existing projects,
project 1 is for service 1, project 2 is service 2.
there are 1 test suite under each project.

-project 1
--test suite1
---test case 1
(response is is ABC for property Age)

-project 2
--test suite 2
---test case 2
(use test 1's out put as the input of test case 2)

how can I create a test case2 in project 2, and use the response from test case 1 as the input of test case 2? Thank you!

3 Replies

  • smartapi's avatar
    smartapi
    Occasional Contributor
    if within one project, we can use transfer property,right?
    not sure how to do it for different project, thanks.
  • smartapi's avatar
    smartapi
    Occasional Contributor
    answers I got via search. haven't try yet.

    ou can do it using groovy script test step:

    //get test case from other project
    project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name)
    testSuite = project.getTestSuiteByName(suite_name);
    testCase = testSuite.getTestCaseByName(testcase_name);

    //set properties
    testRunner.testCase.setPropertyValue(property_name, property_value);
    testRunner.testCase.setPropertyValue(another_property_name, another_property_value);

    // run test case
    runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);

    share|improve this answer
    edited May 21 '13 at 4:50

    answered May 21 '13 at 4:40

    Artem Izyumov
    55426
  • PaulDonny's avatar
    PaulDonny
    Regular Contributor
    Well, there is several different things that come into play here:

    1) Why not have those tests as different test cases in a single suite?

    2) What values are you wanting from the response?

    3) Will having stale data be an issue?

    4) Will test suite 2 ever be ran without test suite 1? If not than there is likely no need for it to be separated.