Forum Discussion

skillsoft's avatar
skillsoft
Frequent Contributor
15 years ago

<SOLVED>Setting Datasource Type with Groovy

Hi,

Is there anyway to set the datasource type with groovy? It seems to be a read-only property as indicated when I try to run this

testRunner.testCase.testSteps["companies"].dataSource.type="Excel"

This particular datasource step may possibly be modified by the user (Start and End Row) and I notice if you choose another datasource type inadvertently all the properties, filename,etc are blanked out. Since I'm passing this script onto another person, I wanted them not to have to worry about resetting the datasource configuration. I figured out how to put the filename and properties back, but not the datasource type.

Thanks,

Mary

2 Replies

  • Hello,

    This field is read only indeed. Try the following:

    testRunner.testCase.testSteps["companies"].modelItem.dataSource = "Excel"

    Hope this helps. This won't affect editor, so if it is open it won't be updated with new type.
    To refresh it you need to close it and open again.

    Regards,
    Predrag.
    www.eviware.com
  • skillsoft's avatar
    skillsoft
    Frequent Contributor
    Hi Predrag,

    That worked like a charm! Thanks for your help!!

    Thanks,

    Mary