String Operations Using Data Bank and Test Suite and Env. Variable Val

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in SOAtest
Hello Everyone,

Below is an example of a Python script that extracts values from various sources (data bank, test suite variable, and environment variable) for use with string operations such as concatenation using the '+' operator...

from soaptest.api import *
from com.parasoft.api import *

# Gets a value from a data bank (line 10) or test suite variable (line 11),
# appends an environment variable value to the front of that value,
# and returns the modified value. Be sure to comment out line 11
# when using line 10 and vice versa.

def getModifiedString(context):
#value = context.getValue("Generated Data Source", "columnName")
value = context.getValue("testSuiteVariableName")

environmentVariableValue = context.getEnvironmentVariableValue("environmentVariableName")

modifiedString = environmentVariableValue + value

return modifiedString

This example is for a fairly specific use case but nonetheless uses some common methods from the SOAtest extensibility API.


Sign In or Register to comment.