Forum Discussion

kamahade's avatar
kamahade
Regular Contributor
16 years ago

[SOLVED]Transfer property from datasource

I have a datasource step in my testcase,Now, I see there are several properties in the Datasource step which are fetched from my DB.

I could able to feed the data in request using following thing.

<copyrightOwner>${DataSource#EM3_MEDIA_ASSET_COPYRIGHT_OWNER}</copyrightOwner>


I want to make datasource step properties as "testcase" properties,so that I can compare values.

please help;

10 Replies

  • Hello,

    I'm sorry, I don't quite understand what it is you are trying to do, can you elaborate a bit? Maybe state an example of what you wish to accomplish? If you want to transfer a DataSource Property to a TestCase Property, you can use the PropertyTransfer TestStep.

    Regards,
    Dain
    eviware.com
  • kamahade's avatar
    kamahade
    Regular Contributor
    I could able to get the properties of datasource step, I want to get it added to testcase level properties...how can I do it ?

      
    Map hashMapDataSource = testRunner.testCase.testSteps["DataSource"].getProperties();
    Set dataSourceSet = hashMapDataSource.keySet();
    TreeSet dataSourceTreeSet = new TreeSet(dataSourceSet);
    def itr = dataSourceTreeSet.iterator();

    while (itr.hasNext()){
    String tempUUIDKey = itr.next().toString();
    TestProperty testProp = hashMapDataSource.get(tempUUIDKey);
    log.info tempUUIDKey + "=" + testProp.getValue();
    }

  • Hello,

    Try changing your Groovy script to this:


    Map hashMapDataSource = testRunner.testCase.testSteps["DataSource"].getProperties();
    Set dataSourceSet = hashMapDataSource.keySet();
    TreeSet dataSourceTreeSet = new TreeSet(dataSourceSet);
    def itr = dataSourceTreeSet.iterator();

    while (itr.hasNext()){
    String tempUUIDKey = itr.next().toString();
    TestProperty testProp = hashMapDataSource.get(tempUUIDKey);
    testRunner.testCase.setProperty( tempUUIDKey, testProp.getValue() );
    }



    Regards,
    Dain
    eviware.com
  • kamahade's avatar
    kamahade
    Regular Contributor
    Thanks much..

    Can I get XMLholder of testcase and do holder.updateproperty()?

    or when I should I invoke updateproperty ?
  • kamahade's avatar
    kamahade
    Regular Contributor
    sorry its again me..

    is it setPropertyValue or setProperty? REF: WsdlTestCase

    Also do we have some extra api for com.eviware.soapui.impl.wsdl.WsdlTestCasePro class?
  • Hello,

    Sorry, you're right, it's setPropertyValue, not setProperty.

    The soapUI PRO API is not publically available.

    Regards,
    Dain
    eviware.com
  • kamahade's avatar
    kamahade
    Regular Contributor

    Can I get XMLholder of testcase and do holder.updateproperty()?

    or when I should I invoke updateproperty ?
  • Hello,

    I'm still not sure what it is you're trying to do that requires you to use an XmlHolder at all. Using the script with setPropertyValue you can extract the values from the DataSource and store it in TestCase Properties. The TestCase itself has no XML, so you can't use an XmlHolder on it.

    Regards,
    Dain
    eviware.com