1

我正在尝试使用 DataProvider (TestNG - Selenium Java) 对两个不同的凭据用户执行相同的测试步骤。我是一个用户,我们称另一个用户为“Bob”。

Bob 能够在他的机器上运行完全相同的代码,但我无法在我的机器上运行完全相同的代码。

我们有相同的 Selenium-Java (2.44.0) 和 TestNG (6.8.13) 版本。

这是代码。因为相同的代码会被两个不同的执行User Type,我们需要使用dataProvider来运行代码。

 @Test(enabled = true, dataProviderClass = Users.class, dataProvider = "alltestCredentials")
 public void profileTest(Credentials credentials) {   
    loginUser(credentials);
    ...            
    logout(); 
    }
}

测试日志结果不同:

鲍勃的机器:

话题一:打开火狐浏览器话题一:进入类:profileTest 话题一:进入方法:profileTest

我的机器:

线程#1:打开Firefox浏览器线程#1:进入类:profileTest 线程#1:准备存在类:profileTest 线程#1:退出类:profileTest java.lang.ExceptionInInitializerError

引起:com.webtest.exception.TestException:用户名是强制性的

为什么代码在 Bob 的机器上运行,而不是我的?

我还需要检查什么以确保 Bob 和我真的拥有相同的系统?

4

0 回答 0