简体   繁体   English

crm 2015 中的硒自动化测试

[英]Selenium Automation testing in crm 2015

我们将在 CRM 2015 中实施 Selenium 自动化测试以进行功能测试(客户建议,因为它是开源工具),我在谷歌和不同的搜索引擎中对 Selenium for CRM 2015 做了很多探索。你能给我建议/指导吗?如何在crm 2015中使用硒

I wonder why isn't it answered yet, basically you can install the nuget package and choose a webdriver for the browser you want to automate.我想知道为什么还没有回答,基本上你可以安装nuget 包并为你想要自动化的浏览器选择一个webdriver Then write a console application like然后编写一个控制台应用程序,如

    using OpenQA.Selenium;
    using OpenQA.Selenium.IE;

    string crmUrl = "http://mycrm.url";
    //create a ieAutomation
    IWebDriver ieAutomation = new InternetExplorerDriver();//BrowserDriver
    
    // open url
    ieAutomation.Navigate().GoToUrl(crmUrl);
    
    // find element by id and set text
    ieAutomation.FindElement(By.Id("name")).SendKeys("set the text");
                    
    // find element by id and make a click
    ieAutomation.FindElement(By.Id("id")).Click();
    
    // close the driver & exit
    ieAutomation.Close();
    ieAutomation.Quit();

This is one quick startup tutorial to start with, you can found more in the documentation .这是一个快速入门教程,您可以在文档中找到更多内容 Although being a SPA it's too expensive to set it up and not worth the effort but LEAPTEST claims it be easy with a price.虽然是 SPA,但它的设置成本太高,不值得付出努力,但 LEAPTEST 声称它很容易,而且价格实惠。

Note: make sure IEDriverServer.exe is available in the Bin\\Debug folder注意:确保IEDriverServer.exeBin\\Debug文件夹中可用

Update 2020: 2020 年更新:

Looking back to this answer i found a Sikuli to be more useful, as it identifies the objects by using image recognition and control GUI (Graphical User Interface) components.回顾这个答案,我发现Sikuli更有用,因为它通过使用图像识别和控制 GUI(图形用户界面)组件来识别对象。 Sikuli is good option when there is no easy access to a GUI's internal or source code.当无法轻松访问 GUI 的内部或源代码时, Sikuli是不错的选择。

For that, you can add Nuget reference为此,您可以添加 Nuget 参考

  <package id="SikuliIntegrator" version="1.1.0" targetFramework="net452" />

You can save the screenshots to a folder say in c:\\\\crm folder and use the code below:您可以将屏幕截图保存到c:\\\\crm文件夹中的文件夹中,并使用以下代码:

static void Main(string[] args)
{

    SikuliModule.SikuliAction.Click("C:\\crm\\Sales.png");
    SikuliModule.SikuliAction.Click("C:\\crm\\Accounts.png");
    SikuliModule.SikuliAction.Click("C:\\crm\\New.png");
    SikuliModule.SikuliAction.DoubleClick("C:\\crm\\ParentAccountQ.png");
    SikuliModule.SikuliAction.Click("C:\\crm\\LookupLense.png");
    //SikuliModule.SikuliAction.Click()
}

Note that this may differ from each OS.请注意,这可能因每个操作系统而异。 Also the configuration was writen a year and half ago by me for php and zend 1. However most of the things should not differ.此外,配置是我一年半前为 php 和 zend 1 编写的。但是大多数事情应该没有区别。

  1. Make sure that you have phpunit确保你有 phpunit

  2. Make sure you have Firefox browser.确保您有 Firefox 浏览器。 (other browsers are ok as well, but firefox has the best support). (其他浏览器也可以,但 firefox 支持最好)。

  3. Go to the following link and download selenium-remote-control-1.0.3.zip.转到以下链接并下载 selenium-remote-control-1.0.3.zip。 http://code.google.com/p/selenium/downloads/detail?name=selenium-remote-control-1.0.3.zip&can=2&q= ( couldn't find a newer verion) http://code.google.com/p/selenium/downloads/detail?name=selenium-remote-control-1.0.3.zip&can=2&q= (找不到更新的版本)

  4. Unzip the zip file, go to selenium-remote-control-1.0.3=> selenium-php-client-driver-1.0.1=> PEAR, copy 'Testing' folder and then paste it to C:\\xampp\\php folder.解压zip文件,进入selenium-remote-control-1.0.3=> selenium-php-client-driver-1.0.1=> PEAR,复制'Testing'文件夹,然后粘贴到C:\\xampp\\php文件夹. The rest of the files add in C:.其余文件添加在 C: 中。 So it becomes C:\\selenium-remote-control-1.0.3\\selenium-server-1.0.3\\所以它变成了 C:\\selenium-remote-control-1.0.3\\selenium-server-1.0.3\\

  5. Download the Selenium RC server http://selenium-release.storage.googleapis.com/index.html?path=2.48/ i was using the standalone file version 2.41 Now there is version 2.48 + some dotnet files下载 Selenium RC 服务器http://selenium-release.storage.googleapis.com/index.html?path=2.48/我使用的是独立文件版本 2.41 现在有版本 2.48 + 一些 dotnet 文件

    5.1. 5.1. to start the server open your command prompt or terminal navigate to C:\\selenium-remote-control-1.0.3\\selenium-server-1.0.3 and type java -jar selenium-server-standalone-2.41.0.jar启动服务器打开你的命令提示符或终端导航到 C:\\selenium-remote-control-1.0.3\\selenium-server-1.0.3 并输入 java -jar selenium-server-standalone-2.41.0.jar

    5.2. 5.2. For the server to run you'll need Java installed and the PATH environment variable correctly configured to run it from the console.要运行服务器,您需要安装 Java 并正确配置 PATH 环境变量以从控制台运行它。 You can check that you have Java correctly installed by running the following on a console:您可以通过在控制台上运行以下命令来检查是否正确安装了 Java:

    java -version版本

    if the version is >= 1.5 you can use Selenium RC如果版本 >= 1.5 你可以使用 Selenium RC

  6. Get Selenium IDE for Firefox and install it http://release.seleniumhq.org/selenium-ide/ pick the version you want.为 Firefox 获取 Selenium IDE 并安装它http://release.seleniumhq.org/selenium-ide/选择你想要的版本。 I was using 2.5.0 at that time.我当时使用的是 2.5.0。

  7. Run already configured test.运行已配置的测试。 Start the selenium server (see point 5.1), navigate to your phpunit tests and run the test.启动 selenium 服务器(参见第 5.1 点),导航到您的 phpunit 测试并运行测试。 Firefox should start after few seconds and perform the test. Firefox 应该会在几秒钟后启动并执行测试。 If there is an error the test will be terminated.如果出现错误,测试将终止。

  8. To record your own tests, start the selenium ide and navigate to the age you want to test and start clicking around.要记录您自己的测试,请启动 selenium ide 并导航到您要测试的年龄并开始单击。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM