Interview Questions

Executing more than one testcase. suppose in first testcase has one functions that is returning some string value. How to use first test case value into second test case

SilkTest Questions and Anwsers


(Continued from previous question...)

122. Executing more than one testcase. suppose in first testcase has one functions that is returning some string value. How to use first test case value into second test case

Answer1:
At the top testcase , to declare something like:
create a global variable gPersonReferenceNumber and pass this into testcases as required.

void TestScriptSetup()
SetAppState ("YOURAPPSTATE")
gPersonReferenceNumber = CreateMinimalTestPerson()

testcase CallGlobalReference() appstate none
string sPersonString = gPersonReferenceNumber

etc
TestScriptSetUp() will be ran prior to CallGlobalReference. You can also include this into your recovery system if need be.

CreateMinimalTestPerson() returns a string value related to PersonID or whatever you would require

Answer2:
1. Use some public (global) variables to store your value
2. Writed testcase to return values, whatever you want and use it in later testcases..

Answer3:
To put it into an ini file or the registry.

Answer4:
Set the values in environment variables by SYS_SetEnv () and use them by SYS_GetEnv () wherever, whenever you want......Global variables also do this, but when you call the test cases from a plan file, global variables get reset......
Other alternative are to store them in a file and use them .

(Continued on next question...)

Other Interview Questions