带有Jenkins的Selenium

带有Jenkins的Selenium

本文介绍了带有Jenkins的Selenium WebDriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究将Selenium WebDriver与Jenkins结合使用.我们有一个在Windows Server 2008下运行的Jenkins服务器,并且要运行我的所有测试用例,并且我正在使用mstest,并且我已经在Windows服务器上安装了VS.这是我在服务器上安装的插件列表. :

I'm looking into using Selenium WebDriver with Jenkins. We have a Jenkins server running under Windows Server 2008 and would like to run all my test cases and I'm using mstest and also i have installed VS on the windows server... Here is the list of plugin I have installed on my server:

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上是否要安装任何插件?

Are there any plugins to installed on Jenkins?

编辑

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

This is what I am using to instantiated my driver, do I have to use 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;
        }

推荐答案

Jenkins上是否要安装任何插件?

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

-No, you do not need these plugins.

这就是我用来实例化驱动程序的内容,我是否必须使用RemoteDriver?

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

I think you need RemoteDriver for executing your test, and you need add initialization for this RemoteDriver in GetDriver() function.

也许可以帮助您链接

我的配置:

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

因此,我使用 Geb 进行测试,但我认为没有区别.

So I use Geb for testing, but I think there is no difference.

这篇关于带有Jenkins的Selenium WebDriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 08:37