• feed4testng


    feed4testng源码文件中的lib下的所有jar包。

    新建类集成FeedTest类

    代码如下

    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;

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

        @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);

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

        }

    }

    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;

    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:UserslenovoAppDataLocalTemp estng-eclipse-1474233715 estng-customsuite.xml

    2015-5-12 9:51:13 com.xxx.test.lib.SeBaselib newSetup
    信息: ****************用户登录****************
    创建 html log ---D:adworkspacexxxtestLogloggingResults用户登录_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

  • 相关阅读:
    改了一下分辨率,Areo特效奇迹般的恢复了...
    此连接需要活动的Internet连接
    Apple Mac OS X每日一技巧026:Spotlight打开文件所在的文件夹
    WP7有约(八):在ListPicker控件的选择页面上播放铃声
    WP7有约(七):实现铃声设置的播放图标的效果
    WP7有约(五):回到主页
    WP7有约:一个应用的破蛋过程
    WP7有约(六):AppBarUtils使用指南
    IE与firefox事件处理
    C#试题
  • 原文地址:https://www.cnblogs.com/stay-sober/p/4482914.html
Copyright © 2020-2023  润新知