How to share variables between tests
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   quan_k
Posted On:   Tuesday, April 29, 2008 07:13 PM

Hi I am trying to write 2 tests and I would like the first test to assign a value to a variable and then the second Test to use that value. I have something like the code below but variable resets to blank after the first test is complete: public class AddNewPayerTest { public String globalID = ""; @test public void AddNewPayer() throws Exception{ globalID = Some value; } @test public void FindPayer() throws Exception{ Set value = globalID; } } Any insight would be greatly appreciated. thank you.    More>>

Hi I am trying to write 2 tests and I would like the first test to assign a value to a variable and then the second Test to use that value.


I have something like the code below but variable resets to blank after the first test is complete:


public class AddNewPayerTest {


public String globalID = "";


@test

public void AddNewPayer() throws Exception{

globalID = Some value;

}

@test

public void FindPayer() throws Exception{

Set value = globalID;

}

}

Any insight would be greatly appreciated. thank you.

   <<Less

Re: How to share variables between tests

Posted By:   Anonymous  
Posted On:   Monday, May 5, 2008 02:47 PM

Not tested here but, have your tried something like



private static Sting globlID="";



in place of



public String globalID = "";



in your code
About | Sitemap | Contact