context variable not getting set

primuppaprimuppa 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 = "**********************"


Application.showMessage(ScenarioName)

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

br.close() 
billingAccountNumber1 = row[header.index(str('billingId'))].strip()
contactEmail1 = row[header.index(str('emailId'))].strip()
Application.showMessage("billingAccountNumber1 : " + billingAccountNumber1)
Application.showMessage("contactEmail1 : " + contactEmail1)
context.setValue('billingId',billingAccountNumber1)
context.setValue('emailId',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

Comments

  • Thomas MooreThomas Moore Posts: 82 admin
    edited April 20

    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

  • primuppaprimuppa Posts: 5
    edited April 20

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

Sign In or Register to comment.