Ask a Question

load properties

sbpatterson
Occasional Contributor

load properties

I am tyring to create a DataSink to an output file, but when I try to load property names from an external file the tool does not import any property names from the header row (the file is actually empty except for header row with the property names).

 

What am I doing incorrect? 

5 REPLIES 5
TanyaYatskovska
SmartBear Alumni (Retired)

Hi sbpatterson,

 

Could you please clarify how exactly you import data from the external file?

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



In my test case I have the following steps:

DataSource

SOAP request

DataSink

DataSource Loop

 

The DataSource (input) is a data file, then the request step runs and I would like to place the responses in a data file. I have a data file with header information that I would like to use as the properties. 

 

I am trying to use the "Load poperty values from an external file" in order to 'import' the property names (about 40 properties) so that I can map the values from the response in the SOAP request.

 

Am I not doing this correctly??  I would like to actually load the property NAMES from a file and not Values. 

You can import property names (header values) from an Excel Spreadsheet for a DataSource, but not for a DataSink at this time. A request for enhancement has been made.

Amber

If you want to auto create properties you can try using a script,

 

 

import java.io.File;
import java.io.FileInputStream;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
FileInputStream file = new FileInputStream(new File('C:\\sample.xls'));
XSSFWorkbook workbook1 = new XSSFWorkbook(file)
XSSFSheet sheet1 = workbook1.getSheetAt(0)
Iterator ite = sheet1.rowIterator();
 
headers=[]
 
Row row = ite.next();
Iterator<Cell> cite = row.cellIterator();
while(cite.hasNext()){
        Cell c = cite.next();
        headers << c.toString()
}
 
file.close();
 
log.info headers
 
for ( i in headers ) {
  testRunner.testCase.testSteps["DataSink"].addProperty(i);
}

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
sbpatterson
Occasional Contributor

Thanks!  I'll try and see if I can use this until an enhancement is made. 

cancel
Showing results for 
Search instead for 
Did you mean: