Forum Discussion

LAGraham's avatar
LAGraham
Occasional Contributor
11 years ago

Environment Custom Property Value not being picked up

I just added two new Custom Properties in my Environment tab and added a Property Transfer to all my Test Requests to pick up those values - about 20 variables in all. Of those 4 are not changing with the Environment correctly - they pick up the previous value.

I have attached screenshots of the Environment settings (changed the actual variable values) and the working and failing Property Transfers. I have tried resetting the Property Transfers that are failing and deleting/readding them. Only these fail and nothing I have tried clears the issue.

Can you see what is wrong? The working and failing versions look the same to me except they are going to different Requests.

Thanks,

Laura

8 Replies

  • LAGraham's avatar
    LAGraham
    Occasional Contributor
    Yes, I have compared the working and nonworking XPaths and they look identical.
  • abhishek813's avatar
    abhishek813
    Frequent Contributor
    I just tried a similar setup on my soapUI (4.5.2) and it work fine.

    Would it be possible for your to provide in your error log/soapUI log?
  • LAGraham's avatar
    LAGraham
    Occasional Contributor
    I have the test setup right now so they are all working in one environment. If I switch the Environment setting to the other environment, the Custom Property value is not picked up, the first environment values are still used.

    If I really need to switch environments right now, I have to
    1) select the new environment
    2) go into each Transfer Property and change the Source Property to an invalid field, then back to the correct Source Property

    then it is switched to the second environment.

    Hope that explains the behavior.

    Laura
  • abhishek813's avatar
    abhishek813
    Frequent Contributor
    Which version of soapUI are you using because what you are describing sounds like a soapUI bug. On my end i'll try to reproduce your scenario and confirm.

    brb
  • abhishek813's avatar
    abhishek813
    Frequent Contributor
    This is definitely a problem as i tried a similar setup (see steps below) and after changing the environment the new custom properties are not picked up, although the built-in properties are picked up correctly.

    1. created two environments
    2. added custom properties (prop1 and prop2) for the two environments
    3. created a new test case
    4. created a property transfer step
    5. created two property transfers to transfer the custom properties to the request xml.


    I tried a work around which worked, try and see maybe it will work for you too. I did not use a property transfer step i directly specified the properties in the request xml (see below) and endpoint url.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.restfulwebservices.net/ServiceContracts/2008/01">
    <soapenv:Header/>
    <soapenv:Body>
    <ns:GetConversionRate>
    <ns:FromCurrency>${#Project#prop1}</ns:FromCurrency>
    <ns:ToCurrency>${#Project#prop2}</ns:ToCurrency>
    </ns:GetConversionRate>
    </soapenv:Body>
    </soapenv:Envelope>


    in the xml prop1 and prop2 are the two custom properties i had created. Imaginative Eh!

    I am sure there must be a mechanism to report bugs to soapUI people not sure how....maybe a smartbear person can tell us *waves arm*

    sorry i couldn't be of much help.
  • soapuitester999's avatar
    soapuitester999
    Occasional Contributor
    Hi Team,

    I faced the similar Problem and below is the workaround that I applied in my SoapUI. Possibly, you can try if wish to.

    1) Create a empty property at Project level. E.g. Account Number
    2) Add a Groovy Script where you usually add Property Transfer step. Remove Property Transfer step.
    3) Make Sure you empty the Property everytime before and after the run. This is good practice.

    //Trigger of Transfer property through Groovy

    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def XmlUtils = new com.eviware.soapui.support.xml.XmlUtils()
    def project = context.testCase.testSuite.project

    //Empty Property Transfer before starting of the script
    project.setPropertyValue("Account Number","")

    //Define the Response Content that you wish to transfer (You can generate this by Right Click > Get Data > Select Request > Response > Value)
    def accountNum = context.expand( '${rq_createAccount#Response#declare namespace
    man=\'xxx:xx.xx.xxx.xxxxx.xxxxxxxxxx:1-0\'; //man:CreateAccountResponse[1]/Account[1]/@account_number}' )

    //Transfer to Project level
    project.setPropertyValue("Account Number", "$accountNum")

    Below script worked for me and I am able to switch between 5 different env to run my test.

    Hope the above helps

    Prashant Nagrecha