I am using Selenium RC in C#. I have list of .cs files, Is there any way to execute all the files without opening multiple开发者_JAVA技巧 instance.
To use the same session per *.cs file use the [TestFixtureSetUp]
attribute instead of the [SetUp]
attribute when starting Selenium.
[TestFixtureSetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://change-this-to-the-site-you-are-testing/");
selenium.Start();
verificationErrors = new StringBuilder();
}
This will run at the beginning of the File before any of the tests and then to kill it off put it in your [TestFixtureTearDown]
[TestFixtureTearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}
And then you can move tests from their individual files per test to 1 file per bit of functionality that you wish to test.
精彩评论