testng.xml 不是 运行 class

testng.xml not running class

我右击我的 testng.xml 和 运行ning 作为测试套件,但是里面的 class 没有 运行.

这是我的 xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="mytestpack" >

 <test name="Firefox Test">

 <parameter name="browser" value="Firefox"/> 

 <classes>

 <class name="mytestpack.MyTestClass" />

 </classes>

 </test>


</suite>

这是 MyTestClass 代码:

package testing_pack;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;

public class MyTestClass {

    private static WebDriver driver;

    @Parameters({"browser"})
    @BeforeTest
    public void setup(String browser) {

         System.out.println(browser);

              // If the browser is Firefox, then do this

              if(browser.equalsIgnoreCase("firefox")) {

                  driver = new FirefoxDriver();

              // If browser is IE, then do this   

              }
         }


    @Test
    public static void test() {

          driver.get("http://only-testing-blog.blogspot.in");
          String i = driver.getCurrentUrl();
          System.out.println(i);

    }
    @AfterTest
    public void teardown() {
        driver.close();
    }
    }

class 运行 单独使用完全没问题。不明白为什么 testng 没有 运行ning 它。它不会抛出它只是显示的任何错误:

[TestNG] Running:
  C:\Users\Laptops\Desktop\eclipse\workspace\testproject\src\mytestpack\testng.xml


===============================================
mytestpack
Total tests run: 0, Failures: 0, Skips: 0
===============================================

谢谢

testng.xml 中的套件名称从 mytestpack 更改为 testing_pack。 class MyTestClass 在不同的包下。