【问题标题】:Selenium WebDriver with JenkinsSelenium WebDriver 与 Jenkins
【发布时间】:2013-03-08 17:28:24
【问题描述】:

我正在研究将 Selenium WebDriver 与 Jenkins 一起使用。我们有一个在 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'',从长远来看它是有回报的。
  • 怎么样?你会扩展你的建议吗

标签: java selenium jenkins selenium-webdriver jenkins-plugins


【解决方案1】:

在 Jenkins 上是否安装了任何插件?

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

这是我用来实例化驱动程序的东西,我必须使用RemoteDriver吗?

我认为您需要RemoteDriver 来执行您的测试,并且您需要在GetDriver() 函数中为这个RemoteDriver 添加初始化。

也许你能帮忙linkthis

我的配置:

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

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

【讨论】:

  • 我不确定我是否遵循你的解决方案,所以它有两个部分 first part is what plug-ins do i need in order to run the selenium test cases in jenkins? 第二部分我会更新我的问题。
  • 如何查看environments
  • 你能给我一个远程驱动程序初始化的代码吗?我需要硒网格吗?
猜你喜欢
  • 2013-07-26
  • 2013-10-16
  • 2015-09-12
  • 2014-08-20
  • 2016-05-29
  • 2015-01-07
  • 2018-05-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多