小编Sco*_*ter的帖子

使用 Eclipse 运行 TestNg 测试组时出现 NPE 错误

我试图通过右键单击作为测试套件的 TestNG.xml 在 TestNG 中运行测试组并获得错误。

java.lang.NullPointerException
at execution_Engine.TestCase1_Login.Login(TestCase1_Login.java:54)
Run Code Online (Sandbox Code Playgroud)

注意:当我自己运行测试(而不是作为测试套件)时,它运行良好。

任何人都可以善意地指出问题所在吗?和解决这个问题。

测试NG文件

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Smoke tests">
<test name="regressions Test Suite">
    <groups> 
        <run> 
            <include name="Regression"/> 
        </run> 
    </groups> 
    <classes> 
        <class name="execution_Engine.TestCase1_Login"/> 
        <class name="execution_Engine.TestCase2_InvalidLogin"/>
    </classes>
            <packages>
        <package name="execution_Engine" />
        </packages> 
</test>
</suite>

@SuppressWarnings("unused")
public class TestCase1_Login  {

public static WebDriver driver = null;

 @BeforeMethod
  public static void LaunchIEandNavigate() {  

      /*** Launch IE **/ 
    System.setProperty "webdriver.ie.driver", "C:\\IE\\IEDriverServer.exe");
      driver = new InternetExplorerDriver();

      /*** implicit Wait **/
      driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

      /*** Navigate to URL …
Run Code Online (Sandbox Code Playgroud)

testng nullpointerexception

3
推荐指数
1
解决办法
2404
查看次数

标签 统计

nullpointerexception ×1

testng ×1