eclipse中testng的配置和使用
阿新 • • 發佈:2019-01-07
Eclipse版本:
Eclipse Java EE IDE for Web Developers.
Version: Helios Release
Testng版本:
5.13
步驟
1.Eclipse中點選Help->Install new software
2.點選Add 在Location輸入 http://beust.com/eclipse
3.選中Testng版本,點選Next,按照提示安裝,安裝完之後重啟Eclipse
4.新建JavaProject,右鍵BuildPath,新增testng-5.11-jdk15.jar和eclipse-testng.jar
5.新建一個sum類,用來計算兩整數之和,程式碼如下:
1234567891011121314 | packagecom.hpp;publicclasssum{privateintno1;privateintno2;privateintmysum;publicintadd(intno1,intno2){mysum=no1+no2;returnmysum;}} |
6.再新建testng class
點選finish,程式碼如下
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
packagecom.test;
importorg.testng.annotations.Test;
import |
testing,xml會自動配置好的,這裡不用管
專案的檔案結構如下:
7.在testing.xml右鍵點選RunAs->Testng Suite,即可看到結果
至於selenium 2 的jar包只需要直接的專案中匯入即可了