我使用 Selenium IDE 1.10.0 记录了一个测试用例。我将案例导出为 Java/TestNG/Remote Control。
我的 Eclipse 版本是 4.2.0,我安装了 TestNG 插件版本 6.8
我想知道如何在 Eclipse 中创建一个项目来运行这个导出的测试用例?
请给我一些指示或与我分享一些在线教程/文档。谢谢!
下面是Eclipse生成的java代码:
package com.example.tests;
import com.thoughtworks.selenium.*;
import org.testng.annotations.*;
import static org.testng.Assert.*;
import java.util.regex.Pattern;
public class SearchDonor extends SeleneseTestNgHelper {
@Test public void testSearchDonor() throws Exception {
// set overall speed of the test case
selenium.setSpeed("4000");
selenium.open("/?html=openid");
selenium.click("css=input[type=\"submit\"]");
selenium.waitForPageToLoad("30000");
Thread.sleep(4000);
selenium.click("id=cmp_admin");
selenium.waitForPageToLoad("30000");
selenium.click("id=quicksearch_anchor");
selenium.click("css=img[alt=\"Member\"]");
selenium.waitForPageToLoad("30000");
selenium.type("id=search_name", "suzy");
selenium.click("css=input[type=\"image\"]");
selenium.click("link=Balagia, Suzy");
selenium.waitForPageToLoad("30000");
}
}