Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

SOAtest: Extension Tool parameterize Datasource File Path

dgoedh
dgoedh Posts: 63

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

Tagged:

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    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}

Tagged