Azure上使用PhantomJS进行的负载测试在用户过多的情况下运行时引发错误
我试图通过Microsoft的指南在Azure上使用PhantomJS运行负载测试 测试打开页面,登录并停留在站点上 大约有20个用户,它工作得很好。当我尝试使用30个或更多用户时,它会抛出错误: 初始化方法SeleniumWebLoadPoc.SelenumLoadWeb.SetupTest引发异常。OpenQA.Selenium.WebDriverException:OpenQA.Selenium.WebDriverException:无法在上启动驱动程序服务。 我的测试代码:Azure上使用PhantomJS进行的负载测试在用户过多的情况下运行时引发错误,azure,selenium,phantomjs,cloud,load-testing,Azure,Selenium,Phantomjs,Cloud,Load Testing,我试图通过Microsoft的指南在Azure上使用PhantomJS运行负载测试 测试打开页面,登录并停留在站点上 大约有20个用户,它工作得很好。当我尝试使用30个或更多用户时,它会抛出错误: 初始化方法SeleniumWebLoadPoc.SelenumLoadWeb.SetupTest引发异常。OpenQA.Selenium.WebDriverException:OpenQA.Selenium.WebDriverException:无法在上启动驱动程序服务。 我的测试代码: [Test
[TestClass]
public class SelenumLoadWeb
{
private IWebDriver _driver;
public TestContext TestContext { get; set; }
private StringBuilder verificationErrors;
private string baseURL;
private bool acceptNextAlert = true;
[TestInitialize]
public void SetupTest()
{
_driver = new PhantomJSDriver();
baseURL = "https://***.com/";
verificationErrors = new StringBuilder();
}
[TestMethod]
[DeploymentItem("SeleniumWebLoadPoc\\OnlyLogin.csv", "SeleniumWebLoadPoc")]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\SeleniumWebLoadPoc\\OnlyLogin.csv", "OnlyLogin#csv", DataAccessMethod.Sequential)]
public void TheSelenumLoadWebTest()
{
var UserName = TestContext.DataRow["UserName"].ToString();
var PassWord = TestContext.DataRow["Pass"].ToString();
// OPEN LOGIN PAGE
TestContext.BeginTimer("SelenumLoadWeb_Navigate");
_driver.Navigate().GoToUrl(baseURL);
TestContext.EndTimer("SelenumLoadWeb_Navigate");
// LOGIN WITH USERNAME AND PASSWORD
_driver.FindElement(By.Id("txtUName")).Click();
_driver.FindElement(By.Id("txtUName")).Clear();
_driver.FindElement(By.Id("txtUName")).SendKeys(UserName);
_driver.FindElement(By.Id("txtPass")).Click();
_driver.FindElement(By.Id("txtPass")).Clear();
_driver.FindElement(By.Id("txtPass")).SendKeys(PassWord);
TestContext.BeginTimer("SelenumLoadWeb_Login");
_driver.FindElement(By.Id("btnOkLogin")).Click();
TestContext.EndTimer("SelenumLoadWeb_Login");
Thread.Sleep(60000);
}
[TestCleanup]
public void TeardownTest()
{
try
{
_driver.Quit();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}
private bool IsElementPresent(By by)
{
try
{
_driver.FindElement(by);
return true;
}
catch (NoSuchElementException)
{
return false;
}
}
private bool IsAlertPresent()
{
try
{
_driver.SwitchTo().Alert();
return true;
}
catch (NoAlertPresentException)
{
return false;
}
}
private string CloseAlertAndGetItsText()
{
try
{
IAlert alert = _driver.SwitchTo().Alert();
string alertText = alert.Text;
if (acceptNextAlert)
{
alert.Accept();
}
else
{
alert.Dismiss();
}
return alertText;
}
finally
{
acceptNextAlert = true;
}
}
}
有人试图对许多用户使用PhantomJS运行负载测试?我不希望从一台机器上生成的PhantomJS进程超过几个。30听起来非常不现实。对,一台机器上最多可以有25个。我不希望从一台机器上产生的幻影进程超过几个。30听起来非常不切实际。对,一台机器最多25台