SOAtest: Extension Tool parameterize Datasource File Path
Hi,
I have got simple jython script, written in Extension tool to refresh the Excel(xls) datasource, just by opening it and saving it to disk again:
from com.parasoft.api import *
from org.apache.poi.hssf.usermodel import *
from java.io import *
DATASOURCENAME = "Vul_Tabel_DS"
fileIn="V:\TSC\Testautomatisering...PreSQL_v0.1.xls"
fileOut="V:\TSC\Testautomatisering...PreSQL_v0.1.xls"
def open_save_DS (input, context):
fin = FileInputStream(fileIn)
wb = HSSFWorkbook(fin)
#First close inputstream to prevent lock
fin.close()
#Open outputstream now
fout = FileOutputStream(fileOut)
#Write to output
wb.write(fout)
fout.close()
How can the entire Filepath to the datasource be parameterized within SOAtest?
Thanks in advance.
Regards,
Daniel
Comments
-
How can the entire Filepath to the datasource be parameterized within SOAtest?
In a script you can reference a variable in various ways depending on the type of variable:
context.getEnvironmentVariableValue("environmentVariableName")
context.getValue("dataSourceName", "columnName")
context.getValue("testSuiteVariableName")In an Excel Data Source editor you can reference variables as well. For example:
${soa_env:path_to_my_excel_file}1