Hi,
I am trying to set value in 1st API test for Global Variable and trying to use in 2nd API test. But in 2nd test I am getting value as NULL.
Does anyone tried the global variable in API tests?
Hi,
I am trying to set value in 1st API test for Global Variable and trying to use in 2nd API test. But in 2nd test I am getting value as NULL.
Does anyone tried the global variable in API tests?
yes, and is working fine if:
Hi,
I am trying following things:-
I have set Global variable GlobalVariable.BostadstillAgg to blank/null in profile
TestCase 1-
response = WS.sendRequest(findTestObject(‘POST_GetIncomeLefi’, [(‘Cookie’) : GlobalVariable.Cookie]))
def slurper = new groovy.json.JsonSlurper()
def output = slurper.parseText(response.getResponseBodyContent())
GlobalVariable.BostadstillAgg = output.benefitInformation[0].amount
KeywordUtil.logInfo("BostadstillAggAmount:- " + GlobalVariable.BostadstillAgg)
Here I can check that GlobalVariable.BostadstillAgg value is set to “1234”
TestCase 2-
response = WS.sendRequest(findTestObject(‘GET_listIncome’, [(‘personId’) : GlobalVariable.personId, (‘Cookie’) : GlobalVariable.Cookie]))
def slurper = new groovy.json.JsonSlurper()
def output = slurper.parseText(response.getResponseBodyContent())
KeywordUtil.logInfo("BostadstillAgg:- "+GlobalVariable.BostadstillAgg)
In testcase2 I am getting GlobalVariable.BostadstillAgg value as Null
I don’t know why but I am getting GlobalVariable.BostadstillAgg value as Null in test case 2.
Can anyone help me to find out the problem ?
did you read carefuly the second condition?
if you run the testcases manualy it won’t work
@ Ibus - Thanks, its working in Test Suite