1
Following a tutorial, my stepDefinitions page looks like this:
@RunWith(DataDrivenTestRunner.class)
@DataLoader(filePaths = "credenciaisv2.csv")
public class CadastrarOLTTest {
private WebDriver browser;
@Before
public void setUp(){
browser = Server.createBrowser();
}
@Test
public void CadastrarOLTv2Test(@Param(name="ip") String ip,
@Param(name="user") String user,
@Param(name="password") String senha,
@Param(name="enable") String enable){
new Login(browser).digitaLogin("admin").insereCredenciaisV2(ip, user, senha, enable);
}
}
With the DataDrivenTestRunner.class
I intend to execute the method insereCredenciaisV2
using the credentials present in the archive credenciaisv2.csv
It turns out he’s running the @Before
every time the @Test
with new parameters, and creating new instances of browser each test. How this can be bypassed?
what version of junit, 5? if not what you need to use is @beforeclass
– Lucas Miranda
the problem is that hence my setup() method will need to be static and causes disorders.
– Pedro Henrique