cancel
Showing results for 
Search instead for 
Did you mean: 

Need function in data source to write properties to a file

SOLVED
Contributor

Need function in data source to write properties to a file

Hi,

 

Under Soapui datasink,  there are functions that we can write properties to a file or import properties from a file. Under data source, there is only function to import from a file. I would like to have the functiom that we can write data source properties to a file so that next time I can reuse it directly or reuse it little update.

 

Thanks for your kind support!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: Need function in data source to write properties to a file

you can try to add a property transfer and dataSink steps. The idea is that you will transter data between you dataSource and DataSinc, and save them to a specific file.

 

Alternatively, if you are comfortable with scripting, you can do a select from groovy (instead of using dataSource step), and save results to the file in the same script using a code example I gave you before.

5 REPLIES 5
Occasional Contributor

Re: Need function in data source to write properties to a file

if you want to write to excel, you can try this groovy script

 

//open your file

Workbook workbook = Workbook.getWorkbook(new File("PATH TO YOUR FILE"));

//set it enable to edit
WritableWorkbook copy = Workbook.createWorkbook(new File("PATH TO YOUR FILE"), workbook)
WritableSheet sheet = copy.getSheet("STEET NAME IN THE FILE WHERE YOU WILL WRITE")

//write to a cell

sheet.addCell( new Label(COLUMN NUMBER,ROW NUMBER, YOUR TEXT))

//close the file

copy.write();
copy.close();
workbook.close();

Re: Need function in data source to write properties to a file

Hello easyfish,

 

Could you give us some more info on what you want to do, e.g. what kind of data source you have and what file format you need.

 

Regards,

Manne, Ready! API Developer

Contributor

Re: Need function in data source to write properties to a file

Thanks for your reply!

 

I have a oracle jdbc data source.  Now we can import data source properties from a csv file.  The csv is like

prop1A, prop1B,prop1D, prop1D

prop2A, prop2B,prop2D, prop2D

 

we can choose the row that we want to import. It is very convenient.

 

What I want to have an inverted function.  We can export the current properties in datasource  to a csv file, which has the same format above.

 

Occasional Contributor

Re: Need function in data source to write properties to a file

you can try to add a property transfer and dataSink steps. The idea is that you will transter data between you dataSource and DataSinc, and save them to a specific file.

 

Alternatively, if you are comfortable with scripting, you can do a select from groovy (instead of using dataSource step), and save results to the file in the same script using a code example I gave you before.

Contributor

Re: Need function in data source to write properties to a file

Thanks so much for your suggestions! I will try it.

New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win