Selenium WebDriver与Jenkins

3

我正在研究如何在Jenkins中使用Selenium WebDriver。我们有一个运行在Windows Server 2008下的Jenkins服务器,希望能够运行所有的测试用例。我正在使用mstest,并且已经在Windows服务器上安装了VS。以下是我在服务器上安装的插件列表:

Selenium Auto Exec Server(AES) plugin
This plugin is for continuous regression test by Selenium Auto Exec Server (AES).      0.5          

Jenkins Selenium Builder plugin
1.1         

Hudson Seleniumhq plugin
This plugin integrates Seleniumhq to Hudson.
0.4         

Selenium HTML report
0.94            

SeleniumRC plugin
This plugin allows you to create Selenium server instance for each project build.
1.0 

有没有可以安装在Jenkins上的插件?
编辑:
这是我用来实例化我的驱动程序的代码,我必须使用RemoteDriver吗?
public static IWebDriver GetDriver()
{
    string _url = new Uri(Common.Url).DnsSafeHost.ToString(); 

     switch (Common.BrowserSelected)
     {
         case "ff":
         FirefoxProfile profile = new FirefoxProfile();
         profile.SetPreference("network.http.phishy-userpass-length", 255);
         profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", _url);
         drv = new FirefoxDriver(profile);
                    break;
          case "ie":
          var options = new InternetExplorerOptions();
           options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
           DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.SetCapability(CapabilityType.AcceptSslCertificates, true);
                    drv = new InternetExplorerDriver(options);
                    break;
                case "chrome":
                    //_driver = new ChromeDriver();
                    break;
            }
            return drv;
        }

我强烈建议您使用“RemoteDriver”,从长远来看这会带来回报。 - aimbire
你会如何扩展你的建议? - Nick Kahn
1个回答

1

Jenkins需要安装哪些插件?

-不需要,您不需要这些插件。

我正在使用以下内容实例化我的驱动程序,我必须使用RemoteDriver吗?

我认为您需要RemoteDriver来执行测试,并且您需要在GetDriver()函数中添加初始化代码以使用此RemoteDriver

也许您可以查看链接这个

我的配置:

firefox {
    capability = DesiredCapabilities.firefox()
    capability.setPlatform(Platform.LINUX)
    driver = {new RemoteWebDriver(new URL("http://some.domain:4444/wd/hub"), capability)}
}

我使用 Geb 进行测试,但我认为没有什么区别。


我不确定我是否理解了你的解决方案,所以它有两个部分。第一部分是我需要哪些插件才能在Jenkins中运行Selenium测试用例?第二部分我会更新我的问题。 - Nick Kahn
你如何检查“环境”? - Nick Kahn
你能为我提供一个初始化远程驱动器的代码吗?我需要使用selenium grid吗? - Nick Kahn

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接