How to get current data source row number?

ParasofttoudayaParasofttoudaya Posts: 180
edited September 2017 in SOAtest

Hi Team,

I came across a situation where i need to get data source current row number in xpath reg-ex.
Let me know how to fetch it??

Thanks
Udaya

Comments

  • benken_parasoftbenken_parasoft Posts: 394 ✭✭✭

    See com.parasoft.api.ScriptingContext.getDataSourceRowIndex(). You'll have to call this from a script or Extension Tool. Your script could store the value into a test suite variable using ScriptingContext.setValue(String variableName, String value) and then your XPath can reference the variable using ${varName}.

  • Thanks Ben

    Thanks a lot for immediate response..

    Regards
    Udaya

  • I am getting -1 always :(

    public void message(Object input, ScriptingContext context){
    Application .showMessage(context.getDataSourceRowIndex())
    }

    its always returning -1.

  • benken_parasoftbenken_parasoft Posts: 394 ✭✭✭
    edited September 2017

    In your Extension Tool, did you enable the "Use data source" box? Is the correct data source selected in the "Data Source" combo?

  • It did worked, good guess. Thanks

Sign In or Register to comment.