Passing information between test methods in a junit testcase
        Posted  
        
            by Jijoy
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jijoy
        
        
        
        Published on 2010-06-14T11:51:32Z
        Indexed on 
            2010/06/14
            12:02 UTC
        
        
        Read the original article
        Hit count: 263
        
Hi,
Currently I am creating a TestCase for one work flow and a workflow have different steps. The results of one step is important since , second step needs to know value of step1's execution.
class TestCaseWorkFlow1 extends TestCase {
  private static String resultOfStep1 = null;
  public void testStep1(){
    if(failed){
        resultOfStep1 = "failed";
    }
  }
  public void testStep2(){
    if(resultOfStep1 != null ) {  
         //First test failed.
    }else {
    }
  }
}
Currently we are using static variable to pass information between testmethods .
What is the best solution for this scenario ?
Please help.
Thanks J
© Stack Overflow or respective owner