نمایش نتایج 1 تا 6 از 6

نام تاپیک: تست موازی selenium Grid

  1. #1

    تست موازی selenium Grid

    کسی میتونه کمک کنه چطور تست هارو به صورت موازی اجرا کنم ؟استفاده از selenium Grid در سی شارپ
    ممنون

  2. #2

    selenim

    تست هارو میخام همزمان رو چند بروزر اجرا بشه
    از سلنیوم گرید استفاده کردم با سی شارپ تست هارو نوشتم با استفده از وب درایور سلنیوم.
    حالا سلنیوم گرید رو میخام اجراش کنم نمیشه
    عکس ضمیمه شده
    لطفا کمک
    12.png

  3. #3

    selenium

    Selenium 1, where the Selenium server was necessary to run tests, Selenium WebDriver does not need a special server to execute tests. Instead, the WebDriver directly starts a browser instance and controls it.
    در متن بالا منظور از سرور همون مرورگر هستش؟

  4. #4

    run selemnium in parallel browsers

    کسی میتونه در باره اجرای چند تست همزمان کمک کنه

  5. #5

    نقل قول: تست موازی selenium Grid

    using OpenQA.Selenium;using System;
    using System.Text;
    using System.Threading;
    using NUnit.Framework;
    using OpenQA.Selenium.Remote;


    namespace FirstPackage
    {
    [TestFixture]
    [Parallelizable]
    public class Methods
    {
    public static IWebDriver driver;
    public static string baseURL;
    public static StringBuilder verificationErrors;


    public void waitFor(string xpath, bool check)
    {
    for (int second = 0; ; second++)
    {
    if (second >= 60) Assert.Fail("timeout");
    try
    {
    if (IsElementPresent(By.XPath(xpath), check)) break;
    }
    catch (Exception)
    { }
    Thread.Sleep(1000);
    }


    }


    private bool IsElementPresent(By by, bool check)
    {
    try
    {


    if (check == true && driver.FindElement(by).Text != string.Empty)
    {
    return true;
    }
    if (check == false)
    {
    driver.FindElement(by);
    return true;
    }
    return false;




    }
    catch (NoSuchElementException)
    {
    return false;
    }
    }
    [OneTimeSetUp]

    public void SetupTest()
    {
    DesiredCapabilities capability = DesiredCapabilities.Chrome();


    driver = new RemoteWebDriver(new Uri("http://192.168.10.173:4444/"),new DesiredCapabilities("chrome","",new Platform(PlatformType.WinNT)));
    //capability.SetCapability("chrome", capability.BrowserName);
    //capability.SetCapability("WIN10", capability.Platform);
    // driver = new ChromeDriver();
    baseURL = "http://192.168.10.173:8080/";
    // driver.Manage().Window.Maximize();
    verificationErrors = new StringBuilder();
    }


    [OneTimeTearDown]

    public void TeardownTest()
    {
    try
    {
    driver.Quit();
    }
    catch (Exception)
    {
    // Ignore errors if unable to close the browser
    }
    Assert.AreEqual("", verificationErrors.ToString());
    }
    }
    }
    using OpenQA.Selenium.IE;
    using OpenQA.Selenium.Support.UI;
    namespace FirstPackage
    {
    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    class AcceptScenario:Methods
    {
    private string elementXpath;
    private bool acceptNextAlert = true;




    [Test, Order(1)]
    [Parallelizable]
    public void registerRequest_AcceptScenario()
    {


    driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "14");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "14");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath,false);
    driver.FindElement(By.Id("btnSubmit")).Click();

    }
    [Test, Order(2)]
    [Parallelizable]
    public void TheConformThirdDegreeTest()
    {


    driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "97340309");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "1");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath, false);
    driver.FindElement(By.Id("btnSubmit")).Click();

    }
    [Test, Order(3)]
    [Parallelizable]
    public void TheConfirmSecondDegreeTest()
    {


    driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "994047273");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "1");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath, false);
    driver.FindElement(By.Id("btnSubmit")).Click();

    }
    [Test, Order(4)]
    [Parallelizable]
    public void TheConfirmFirstDegreeTest()
    {


    driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "994047159");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "1");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath, false);
    driver.FindElement(By.Id("btnSubmit")).Click();
    elementXpath = "//div[@id='ctl00_SiteMenu1_siteMenu']/ul/li[8]/div/ul/li/a/span/span";
    waitFor(elementXpath,false);
    driver.FindElement(By.XPath("//div[@id='ctl00_SiteMenu1_siteMenu']/ul/li[8]/a/span/span")).Click();
    driver.FindElement(By.CssSelector("span.rpText > span")).Click();
    //
    Assert.AreEqual("14", driver.FindElement(By.XPath("//tr[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[13]")).Text);
    Assert.AreEqual("name", driver.FindElement(By.XPath("//tr[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[12]")).Text);
    Assert.AreEqual("money", driver.FindElement(By.XPath("//tr[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[11]")).Text);
    Assert.AreEqual("tst", driver.FindElement(By.CssSelector("td.rgSorted")). Text, "test");
    Assert.AreEqual("tst", driver.FindElement(By.XPath("//tr[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[8]")).Text);
    Assert.AreEqual("follow", driver.FindElement(By.XPath(".//*[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[3]")).Text);
    //
    driver.FindElement(By.XPath("//tr[@id='ctl00_ContentPlaceHolder1_grdVacationList_ctl 00__0']/td[11]")).Click();
    elementXpath = ".//*[@id='ctl00_ContentPlaceHolder1_btnApprove']";
    waitFor(elementXpath,false);
    driver.FindElement(By.Id("ctl00_ContentPlaceHolder 1_btnApprove")).Click();

    elementXpath = ".//*[@id='ctl00_ContentPlaceHolder1_lblError']";
    waitFor(elementXpath,true);
    string errorLabel = driver.FindElement(By.XPath(".//*[@id='ctl00_ContentPlaceHolder1_lblError']")).Text;
    Assert.AreEqual("hello", errorLabel, "test");
    }


    }
    }
    using NUnit.Framework;
    using OpenQA.Selenium;
    using OpenQA.Selenium.Support.UI;


    namespace FirstPackage
    {
    [TestFixture]
    [Parallelizable(ParallelScope.Fixtures)]
    class RejectScenario:Methods
    {


    private string elementXpath;




    [Test, Order(1)]
    [Parallelizable]


    public void registerRequest_RejectCsenario()
    {
    //if(driver!=null)
    driver.Url = baseURL + "/eosLogin.aspx";
    //driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "14");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "14");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath, false);
    driver.FindElement(By.Id("btnSubmit")).Click();
    elementXpath = ".//*[@id='ctl00_SiteMenu1_siteMenu']/ul/li[4]/a/span/span";
    waitFor(elementXpath, false);
    driver.FindElement(By.XPath(".//*[@id='ctl00_SiteMenu1_siteMenu']/ul/li[4]/a/span/span")).Click();
    driver.FindElement(By.XPath(".//*[@id='ctl00_SiteMenu1_siteMenu']/ul/li[4]/div/ul/li[1]/a/span/span")).Click();
    elementXpath = ".//*[@id='ctl00_ContentPlaceHolder1_ddlVacationList']";
    waitFor(elementXpath, false);


    //
    new SelectElement(driver.FindElement(By.Id("ctl00_Cont entPlaceHolder1_ddlVacationList"))).SelectByText(" hello");
    driver.FindElement(By.CssSelector("option[value=\"2\"]")).Click();
    driver.FindElement(By.XPath(".//*[@id='ctl00_ContentPlaceHolder1_txtbeginDate']")).Click();
    driver.FindElement(By.LinkText("۱۷")).Click();
    driver.FindElement(By.XPath(".//*[@id='ctl00_ContentPlaceHolder1_txtEndDate']")).Click();
    driver.FindElement(By.XPath("(//a[contains(text(),'۱۷')])[2]")).Click();
    //
    driver.FindElement(By.Id("ctl00_ContentPlaceHolder 1_btnSubmit")).Click();

    elementXpath = ".//*[@id='ctl00_ContentPlaceHolder1_lblError']";
    waitFor(elementXpath, true);
    string errorLabel = driver.FindElement(By.XPath(".//*[@id='ctl00_ContentPlaceHolder1_lblError']")).Text;
    Assert.AreEqual("hello", errorLabel, "test");
    }
    [Test,Order(2)]
    [Parallelizable]

    public void RejectRequest_ByManager()
    {
    driver.Url = baseURL + "/eosLogin.aspx";


    //driver.Navigate().GoToUrl(baseURL + "/eosLogin.aspx");
    driver.FindElement(By.Id("txtUserName")).Clear();
    driver.FindElement(By.Id("txtUserName")).SendKeys( "97340309");
    driver.FindElement(By.Id("txtPassword")).Clear();
    driver.FindElement(By.Id("txtPassword")).SendKeys( "1");
    elementXpath = ".//*[@id='btnSubmit']";
    waitFor(elementXpath, false);
    driver.FindElement(By.Id("btnSubmit")).Click();
    elementXpath ="//div[@id='ctl00_SiteMenu1_siteMenu']/ul/li[8]/a/span/span";
    waitFor(elementXpath,false);
    driver.FindElement(By.XPath("//div[@id='ctl00_SiteMenu1_siteMenu']/ul/li[8]/a/span/span")).Click();
    driver.FindElement(By.CssSelector("span.rpText > span")).Click();
    driver.FindElement(By.CssSelector("#ctl00_ContentP laceHolder1_grdVacationList_ctl00__1 > td.rgSorted")).Click();
    elementXpath = ".//*[@id='ctl00_ContentPlaceHolder1_txtAdminParaf']";
    waitFor(elementXpath,false);
    driver.FindElement(By.Id("ctl00_ContentPlaceHolder 1_txtAdminParaf")).Clear();
    driver.FindElement(By.Id("ctl00_ContentPlaceHolder 1_txtAdminParaf")).SendKeys("test");
    driver.FindElement(By.Id("ctl00_ContentPlaceHolder 1_btnReject")).Click();
    }
    }
    }


    کد بالا کدهای تست هستش که با grid میخام تست موازی انجام بدم اما همچین خطایی میده
    Unable to cast object of type 'System.String' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]

  6. #6

    نقل قول: تست موازی selenium Grid

    این هم عکس نود و هابی هستش که ست کردم

    کسی میتونه کمک کنه

    1212.png

تاپیک های مشابه

  1. تست وجود فونت در دلفی
    نوشته شده توسط بیگدلی در بخش مباحث عمومی دلفی و پاسکال
    پاسخ: 12
    آخرین پست: سه شنبه 16 مهر 1392, 08:48 صبح
  2. تست خالی بودن grid view
    نوشته شده توسط jaykob در بخش ASP.NET Web Forms
    پاسخ: 2
    آخرین پست: یک شنبه 22 اسفند 1389, 13:31 عصر
  3. پاسخ: 3
    آخرین پست: یک شنبه 27 شهریور 1384, 10:59 صبح
  4. تست نرم افزار 2
    نوشته شده توسط سعید قدیری مقدم در بخش VB.NET
    پاسخ: 17
    آخرین پست: چهارشنبه 22 مرداد 1382, 16:57 عصر
  5. تست نرم افزار
    نوشته شده توسط سعید قدیری مقدم در بخش VB.NET
    پاسخ: 13
    آخرین پست: یک شنبه 12 مرداد 1382, 01:38 صبح

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •