Forum Discussion

Aman85's avatar
Aman85
Occasional Contributor
8 years ago

Using Context object in another test step within same test case.

Hi,

 

I am trying data driven testing using Microsoft excel sheet(.xslx) and apache POI API for excel.

After performing Data set up in 1 groovy test step using Sheet name 'sourceSheet' , i add a reference to the sheet as a context property, in order for it to be accessible for other steps using:

 

context.srcWkSheet = sourceSheet

 

in the last groovy test step, when i try to access the workbook using the Sheet name referenced above using 

def wrkBook = context.srcWkSheet.getWorkbook()

 

i get an error "cannot invoke method getWorkbook() on a null object.

 

please help me with this.

No RepliesBe the first to reply