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.

context variable not getting set

primuppa Posts: 5

from com.parasoft.api import *
from java.io import *
import java.util.ArrayList as ArrayList
from java.util import *

def readCSVFields(input,context):

CSVPath = context.getAbsolutePathFile(' ');

contextFilePath = CSVPath.getAbsolutePath().strip()
contextFilePath = contextFilePath.replace("/ /", "/");

fr = contextFilePath + "TestFile" + File.separator + "TestFile.csv";
ScenarioName = "**********************"


br = BufferedReader(FileReader(fr))      
line = ''
while line != None:
    line = br.readLine()
    if line != None:
        if 'Scenario_Name' in line:
            header = str(line).split(',')
        if ScenarioName in line :
            row = str(line).split(',')

billingAccountNumber1 = row[header.index(str('billingId'))].strip()
contactEmail1 = row[header.index(str('emailId'))].strip()
Application.showMessage("billingAccountNumber1 : " + billingAccountNumber1)
Application.showMessage("contactEmail1 : " + contactEmail1)

Once setting variables through the above script in extension tool, tried to use it as ${billingId} and ${emailId} in the soap request later. But not working.

I am not sure what I am doing wrong


  • Thomas Moore
    Thomas Moore Posts: 82 admin
    edited April 2021

    Hi primuppa,

    Are the variables you are setting defined in your test scenario's variables section?

    If not, then where are they being created?

    Edit: bad resolution screenshot

  • primuppa
    primuppa Posts: 5
    edited April 2021

    Looks like I missed to do so @Thomas Moore . Thank you! It works fine now.