Forum Discussion

kanius's avatar
kanius
Occasional Contributor
12 years ago

[Escalated] Enumeration value merge

I have a field in my request that use a bitwise concept.

I need to be able to send for example "testvalue" and "testvalue2". In our project we send 3 (value 1+2 ) in the field but In soapUi I need to send the text Enumeration value , Is their a way to send testvalue&testvalue2 or something like that.

When I click on the field in the xml the tab XSD show me these information. can we use the enumerationValue form the serialization or maybe a way to join the enumeration like "testvalue"


<xs:enumeration value="None">
<xs:annotation>
<xs:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">0</EnumerationValue>
</xs:appinfo>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Testvalue">
<xs:annotation>
<xs:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1</EnumerationValue>
</xs:appinfo>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="Testvalue2">
<xs:annotation>
<xs:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">2</EnumerationValue>
</xs:appinfo>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="All">
<xs:annotation>
<xs:appinfo>
<EnumerationValue xmlns="http://schemas.microsoft.com/2003/10/Serialization/">255</EnumerationValue>
</xs:appinfo>
</xs:annotation>
</xs:enumeration>

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi David,

    I believe it's possible to achieve what you want with a Groovy Script.
    In order to do that, you must follow these steps:

    - Create a TestSuite Custom property (open the testSuite editor and click on the "Custom Properties" at the bottom-left of the screen) called "prop1" for example.
    - Create a Groovy Script TestStep just before your request with code similar to this, so you can programmatically set the value of prop1 to the calculated value you want.

    def calculatedValue = 2 // make some calculation here
    testRunner.testCase.testSuite.setPropertyValue( "prop1", calculatedValue as String )
    def prop1 = context.expand( '${#TestSuite#prop1}' )
    log.info( "Set prop1 to $prop1" )

    - In your Request TestStep, set the value of field ExtendedInfo to ${#TestSuite#prop1}

    Now, when you run your TestSuite, the field ExtendedInfo will take whatever value you set to it in the Groovy Script.

    Please let us know if this worked for you.

    Regards,

    Renato
    SmartBear Software