开发者

How to transfer the value from one test suite to another test suite in soap ui

Here i am giving my requirement if any one help me on this to resolve.

I have two test suites.

  1. Test Suite 1 it has 40 test cases
  2. Test Suite 2 it has 30 test cases

I have hardcoded the consumer id (which is one parameter in test suite 1). every test case in suite 1 and suite should have different consumer id. so I am incrementing that value using groovy script..

So i need to take the consumer id value from the test suite once 40 TC is executed in Test suite 1 and pass that value to test suite 2.

Is it possible?

Eg., i have hardcoded consumer id as 1 in Test suite. it will increment automatically one in every tc. Finally 开发者_如何学Goit will come 40.

Now i need to set 40 as consumer id in Test suite 2.

Regards, Chandra


You can transfer almost any value or variable in soapUI using a "Property Transfer" test step. Unfortunately it seems as if this is not working between test suites. You could try using a double property transfer via the test project.

  1. Transfer the consumer ID from test suite #1 to a project property.
  2. Transfer the consumer ID from project property to test suite #2 property when starting the first test case of this suite.

Here's a sample project which could be what you're looking for.

<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-project name="Test Project" resourceRoot="" soapui-version="3.6.1"
    xmlns:con="http://eviware.com/soapui/config">
    <con:settings/>
    <con:testSuite name="TestSuite 1">
        <con:settings/>
        <con:runType>SEQUENTIAL</con:runType>
        <con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false"
            maxResults="0" name="Last TestCase" searchProperties="true">
            <con:settings/>
            <con:testStep type="transfer" name="Property Transfer">
                <con:settings/>
                <con:config xsi:type="con:PropertyTransfersStep"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <con:transfers setNullOnMissingSource="true" transferTextContent="true"
                        failOnError="true" ignoreEmpty="false" transferToAll="false"
                        useXQuery="false" entitize="false" transferChildNodes="false">
                        <con:name>Consumer ID</con:name>
                        <con:sourceType>Consumer ID</con:sourceType>
                        <con:sourceStep>#TestSuite#</con:sourceStep>
                        <con:targetType>Consumer ID</con:targetType>
                        <con:targetStep>#Project#</con:targetStep>
                    </con:transfers>
                </con:config>
            </con:testStep>
            <con:testStep type="groovy" name="Groovy Script">
                <con:settings/>
                <con:config>
                    <script>def consumerId = context.expand( '${#TestSuite#Consumer ID}' ) </script>
                </con:config>
            </con:testStep>
            <con:properties/>
            <con:reportParameters/>
        </con:testCase>
        <con:properties>
            <con:property>
                <con:name>Consumer ID</con:name>
                <con:value>1</con:value>
            </con:property>
        </con:properties>
        <con:reportParameters/>
    </con:testSuite>
    <con:testSuite name="TestSuite 2">
        <con:settings/>
        <con:runType>SEQUENTIAL</con:runType>
        <con:testCase failOnError="true" failTestCaseOnErrors="true" keepSession="false"
            maxResults="0" name="TestCase 1" searchProperties="true"
            id="484d355d-8bab-442c-b3ae-5d2c131d9317">
            <con:settings/>
            <con:properties/>
            <con:reportParameters/>
        </con:testCase>
        <con:properties>
            <con:property>
                <con:name>Consumer ID</con:name>
                <con:value>test</con:value>
            </con:property>
        </con:properties>
        <con:setupScript>def consumerId = context.expand( '${#Project#Consumer ID}' )
            testSuite.setPropertyValue('Consumer ID', consumerId)</con:setupScript>
        <con:reportParameters/>
    </con:testSuite>
    <con:requirements/>
    <con:properties>
        <con:property>
            <con:name>Consumer ID</con:name>
            <con:value>test</con:value>
        </con:property>
    </con:properties>
    <con:wssContainer/>
    <con:databaseConnectionContainer/>
    <con:reporting>
        <con:reportTemplates/>
        <con:xmlTemplates/>
        <con:parameters/>
    </con:reporting>
</con:soapui-project>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜