How to take values from xml or json data banks into groovy scripts.

NavsidNavsid Posts: 2

Im trying to take the values from data bank into script but getting error can anyone help me out.

Answers

  • Ireneusz SzmigielIreneusz Szmigiel Posts: 214 ✭✭✭

    Hi Navsid,

    what error do you see?
    Usually it should be straight forward like is described in User Manual
    See section Accessing Data Sources from Scripts.
    You can find a couple examples on this forum

    --
    Ireneusz Szmigiel
    http://www.catb.org/esr/faqs/smart-questions.html

  • NavsidNavsid Posts: 2

    Hi how to take key from xml and json data banks into groovy scripts. And perfrom operations on that values and need to pass a specific value to next test.

  • jakubiakjakubiak Posts: 691 admin

    In the script, the method needs to define the context object, and then it needs to call getValue() on that context like in the following example, where "dataBankColumnName" is the name of the data bank column you defined:

    import com.parasoft.api.*;
    
    public void doSomething(Context context) {
        context.getValue("Generated Data Source", "dataBankColumnName")
    }
    

    I just typed up this example quickly without testing it, so it may take some tweaks to make it work if I have a typo.

Sign In or Register to comment.