运行 我的代码使用 TestNG 和 Cucumber 时出现空指针异常?

Getting null pointer exception while run my code with TestNG and Cucumber?

获取 "Null pointer Exception" 而 运行 我的代码。

Runner class

Main Class

在@BeforeSuite 方法内的 TestRunner class 中初始化的驱动程序实例不会在 SignIn class 内自动检索。您应该创建一个 getter 方法来从 TestRunner 获取驱动程序对象到 SignIn class 或使用继承概念来获取驱动程序。这就是您收到 NullPointerException 的原因。您正在尝试访问未在 SignIn class.

中初始化的驱动程序对象