feed4testng

feed4testng源碼文件中的lib下的全部jar包。html

新建類集成FeedTest類eclipse

代碼以下ide

 

import org.databene.feed4testng.FeedTest;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert; ui

import org.testng.annotations.Test;
import org.databene.benerator.anno.Source;
public class TEst extends FeedTest { spa

    @Test(dataProvider = "feeder")
    @Source("data/test.xls")
    public void login(String Username,String password) throws InterruptedException {
        WebDriver dr = new FirefoxDriver();
        dr.get("http://www.xxx.com/user/login");
        dr.findElement(By.id("email")).clear();
        dr.findElement(By.id("email")).sendKeys(Username);
        dr.findElement(By.id("t_pass")).click();
        dr.findElement(By.id("password")).sendKeys(password); firefox

        dr.findElement(By.id("doLogin")).click();
        Thread.sleep(3000);
        Assert.assertEquals("xxx-用戶中心", dr.getTitle()); xml

    } htm

}blog

 

import org.databene.feed4testng.FeedTest;
import org.testng.annotations.Test;
import org.databene.benerator.anno.Source;
import student.page.LoginPage;
import student.page.Question_detail;
import student.page.Stu_Ask;
import student.page.Stu_Index; ip

import com.dezhi.test.lib.BaseLib;

public class TEst extends FeedTest {

    @Test(dataProvider = "feeder")
    @Source("data/test.xls")
    public void login(String Username, String password)  {
         LoginPage lg=new LoginPage();
         Stu_Index stu=lg.login(Username, password);
         Stu_Ask stu_ask=stu.ask();
         String title="title",content="content",thought="thought";
         try {
            title="title"+BaseLib.getCurrentTime();
             content="content"+BaseLib.getCurrentTime();
             thought="thought"+BaseLib.getCurrentTime();

        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
         Question_detail qd=stu_ask.submitQuestion1("初二", "物理", title, content, thought);
         System.out.println(qd.getUrl());
    }

}

 

[TestNG] Running:
  C:\Users\lenovo\AppData\Local\Temp\testng-eclipse-1474233715\testng-customsuite.xml

2015-5-12 9:51:13 com.xxx.test.lib.SeBaselib newSetup
信息: ****************用戶登陸****************
建立 html log ---D:\adworkspace\xxxtest\Log\loggingResults\用戶登陸_2015-5-12-9-51-13_ff_log.html
2015-5-12 9:51:24 com.xxx.test.lib.SeBaselib newSetup
信息: 初始化---成功!
2015-5-12 9:51:27 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素email
2015-5-12 9:51:28 com.xxx.test.lib.SeBaselib newType
信息: 輸入email : 808@4.cn
2015-5-12 9:51:32 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素password
2015-5-12 9:51:32 com.xxx.test.lib.SeBaselib newType
信息: 輸入password : 111111
2015-5-12 9:51:38 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素doLogin
2015-5-12 9:51:40 com.xxx.test.lib.SeBaselib newClick
信息: 點擊成功!
2015-5-12 9:51:46 com.xxx.test.lib.SeBaselib newAssertEquals
信息: 實際值:http://www.xxx.cn/student/index 與 指望值:http://www.xxx.cn/student/index匹配
2015-5-12 9:51:46 com.xxx.test.lib.HTMLReport logWriter
信息: 學生進入我的中心
2015-5-12 9:51:53 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素
2015-5-12 9:51:53 com.xxx.test.lib.SeBaselib newClick
信息: 點擊成功!
2015-5-12 9:51:58 com.xxx.test.lib.SeBaselib newAssertEquals
信息: 實際值:http://www.xxx.cn/student/ask 與 指望值:http://www.xxx.cn/student/ask匹配
2015-5-12 9:51:58 com.xxx.test.lib.HTMLReport logWriter
信息: 進入提問頁面
2015-5-12 9:52:04 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素grade
2015-5-12 9:52:04 com.xxx.test.lib.SeBaselib newSelect
嚴重: 選擇元素-----grade初二
2015-5-12 9:52:11 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素subject
2015-5-12 9:52:11 com.xxx.test.lib.SeBaselib newSelect
嚴重: 選擇元素-----subject物理
2015-5-12 9:52:14 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素title
2015-5-12 9:52:14 com.xxx.test.lib.SeBaselib newType
信息: 輸入title : title2015-5-12-9-51-58
2015-5-12 9:52:18 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素tinymce
2015-5-12 9:52:18 com.xxx.test.lib.SeBaselib newType
信息: 輸入tinymce : content2015-5-12-9-51-58
2015-5-12 9:52:22 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素thought
2015-5-12 9:52:22 com.xxx.test.lib.SeBaselib newType
信息: 輸入thought : thought2015-5-12-9-51-58
2015-5-12 9:52:31 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素
2015-5-12 9:52:34 com.xxx.test.lib.SeBaselib newClick
信息: 點擊成功!
2015-5-12 9:52:40 com.xxx.test.lib.SeBaselib newIsElementPresent
信息: 找到元素checksure
2015-5-12 9:52:41 com.xxx.test.lib.SeBaselib newClick
信息: 點擊成功!
2015-5-12 9:52:47 com.xxx.test.lib.SeBaselib newAssertEquals
信息: 實際值:title2015-5-12-9-51-58 與 指望值:title2015-5-12-9-51-58匹配
2015-5-12 9:52:47 com.xxx.test.lib.HTMLReport logWriter
信息: 提問成功
http://www.xxx.cn/student/question-detail/id/13231/isfirst/first
PASSED: login("808@4.cn", "111111")

===============================================
    Default test
    Tests run: 1, Failures: 0, Skips: 0
===============================================

===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@b66cc: 16 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@1a679b7: 33 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@e102dc: 31 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@1e0bc08: 16 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter@1037c71: 0 ms
[TestNG] Time taken by [TestListenerAdapter] Passed:0 Failed:0 Skipped:0]: 0 ms
3

image

相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息