The task is to transfer the value from one test to another. Trying to do this with ITestContext:

public class One { int waterfallId; @Test() public void testOne(ITestContext ctx) { /*код теста, инициализируется переменная waterfallId*/ ctx.setAttribute("waterfallId", waterfallId); } @Test() public void testTwo(ITestContext ctx) { ctx.getAttribute("waterfallId"); //возвращает null } } 

What's wrong? What are some other solutions?

  • Why did you need to pass the value in the first place? - etki
  • @Etki, because I do not know in advance the value of this variable, but I receive it during the test - redL1ne
  • 2
    Tests should not depend on each other. In addition, the order of execution may be different - there is no guarantee that testTwo will run after testOne. It is better to do data acquisition separately, either in the test itself, or before executing the test suite. - aNNiMON
  • @ redL1ne looks like you actually have one test, not two - etki

0