Thursday, March 9, 2017

SOAPUI : Access Properties at different levels (Property Expansion)

Access Properties at different levels (Property Expansion)


Property Expansion(http://readyapi.smartbear.com/features/expansions/syntax) :

1) TestStep properties =  ${TestStepName#MyPropertyName}
2)Test case properties =${#TestCase#MyPropertyName}   -- Here TestCase is keyword
3)Project properties =   ${#Project#MyPropertyName}  --- Here Project  is keyword

Examples:
log.info context.expand('${#TestCase#endpoint3}')   // Groovy
or
Directly use : ${#TestCase#endpoint3}
In any Request


Using Properties values from a different testcase :


-----Working with current test case -----------
SET    :     testRunner.testCase.setPropertyValue("endpoint",endpoint)
GET :       log.info testRunner.testCase.getPropertyValue("endpoint")


----------------------------Working with some other test case -------------
get Value :
def project = testRunner.testCase.testSuite.project
log.info project.testSuites['TestSuite 1'].testCases['TC anme'].getTestStepByName("StepName").getPropertyValue("property_name")

Example :
def project = testRunner.testCase.testSuite.project
log.info project.testSuites['TestSuite 1'].testCases['GenericKmauthtoken'].getTestStepByName("Count").getPropertyValue("authentication_PropertyFile")

No comments:

Post a Comment