Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20755

using global variables in test complete

$
0
0

I have code set up in 2 separate run scripts based on my testing needs. Steps:

 

1) want to execute test script #1 (see below)

2) then I will be executing a keyword test

3) then execute test script # 2 (see below)

 

I defined a global variable in test script #1 below. I then need for test script #2 to use the global variable from test script #1. How do I code test script #2?

 

Test script #1:

 

function test ()

{

 

var page = Sys.Browser("iexplore").Page("https://staging.studies.jaeb.org/ndocs/sysdev/Tests/JaebWeb/BasicControlsAndJfe/Validations/TextBox/TextBoxRequiredClient.aspx").Form("aspnetForm");

var state = page.elements.__VIEWSTATE.value }

 

//Global variable:

 

function testProcedure(page1)

{

page1 = page.elements.__VIEWSTATE.value; }

 

Test script #2:

 

function test ()

{

var page = Sys.Browser("iexplore").Page("https://staging.studies.jaeb.org/ndocs/sysdev/Tests/JaebWeb/BasicControlsAndJfe/Validations/TextBox/TextBoxRequiredClient.aspx").Form("aspnetForm");

var x = page1 (this does not worked coded this way). Error message saying "page1" is undefined

var newstate = page.Elements.__VIEWSTATE.value;

if (state == newstate)

   Log.Message ("Postback hasn't been invoked");

else

   Log.Message ("Postback has been invoked"); }


Viewing all articles
Browse latest Browse all 20755

Trending Articles