eclipse中使用testng,eclipse安装testng

TestNG是一个设计用来简化广泛的测试需求的测试框架,从单元测试(隔离测试一个类)到集成测试(测试由有多个类多个包甚至多个外部框架组成的整个系统,例如运用服务器)。

在没有TestNg的情况下,我们要想运行一个类必须要通过main方法作为入口去运行;
有了TestNg我们通过注解@Test 即可运行被标注的类;

下面我们看一下TestNg在eclipse中的安装。

安装testng

在eclipse help下找到eclipse marketplace  --- find  testng ----- 

26.png

intstall --- confirm ----  finish --- 出现警告-点 ok 即可

重启eclipse即完成安装;
将tesng用于我们的项目
project --- 右键 --- build path --- configuration build path---libraries  --add libraries  --testng


-----------------------------------

    @Test
    public void  SS(){
        // TODO Auto-generated method stub
          System.out.println("start firefox browser...");
          System.setProperty("webdriver.firefox.bin", "D:\project\Mozilla Firefox\firefox.exe");
          WebDriver driver = new FirefoxDriver();
Navigation navigation = driver.navigate();
          navigation.to("http://www.baidu.com/");
           System.out.println("start firefox browser succeed...");
        
    }

完成 测试效果 方法上加入@Test  然后项目右键Run as  选择testng  test
QQ截图20160629153746.png






相关标签:


评论: