我试图执行在Eclipse中使用Junit4一个简单的测试用例(3.7.0版本)Eclipse的运行方式不显示的Junit TestNG的或选项
1)我的运行图标点击(旁边调试2)单击运行配置选项,在创建,管理和运行配置窗口中,我看到左侧窗格中列出了Junit和TestNG
3)单击窗口>显示视图>我能看到的Junit和TestNG作为一个选项列出
请告诉我如何解决 这个问题。谢谢!
项目名称:webDriverMethods
下面是我的代码
import org.junit.*;
import static org.junit.Assert.*;
import java.util.*;
import org.testng.annotations.*;
import org.testng.annotations.Test; //added 5 imports for Junit and testNG
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class webDriverMethodsTest
{
@Test
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
}
}
你好Cedric,建议。我通过添加这些行来修改代码:1)** import org.junit.Test **,注释掉testNG的Test注解; 2)在main方法中删除** static **关键字,取出main方法中的参数,然后给方法一个不同的名称。 3)点击运行随着显示的Junit测试选项+代码工作。谢谢您的帮助! – user2061466 2013-04-24 01:29:05