Eclipse plugin 如何在Eclipse中使用TestNG运行导出的selenium测试用例

Eclipse plugin 如何在Eclipse中使用TestNG运行导出的selenium测试用例,eclipse-plugin,testng,selenium-ide,Eclipse Plugin,Testng,Selenium Ide,我使用SeleniumIDE1.10.0记录了一个测试用例。我将案例导出为Java/TestNG/remotecontrol 我的Eclipse版本是4.2.0,安装了TestNG插件版本6.8 我想知道如何在eclipse中创建一个项目来运行这个导出的测试用例 请给我一些指导或与我分享一些在线教程/文档。谢谢 下面是Eclipse生成的java代码: package com.example.tests; import com.thoughtworks.selenium.*; import o

我使用SeleniumIDE1.10.0记录了一个测试用例。我将案例导出为Java/TestNG/remotecontrol

我的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");
    }
}

经过一些尝试和错误。我设法在Eclipse中以TestNG Test的形式执行导出的代码。以下是我为使其编译而采取的步骤

1.在Eclipse中创建了一个Java项目

2.向Java项目添加一个类

2a. I copied and pasted the code into the newly created the class
3.右键单击项目>生成路径>配置生成路径

3a。在Java构建路径窗口中,选择libraries>Add External JAR,然后添加Selenium Java驱动程序文件夹中的所有JAR文件(例如,本例中的文件夹名为libs),再加上Selenium-Java-2.31.0.JAR和Selenium-Java-2.31-src.JAR

4.单击顶部菜单栏上调试图标旁边的运行图标,运行方式为TestNG Test

我的代码正在编译,但出现了一些异常错误。我被盯上了一个TestNG测试用例