我已经从下面的链接中实现了alannings示例:但是,当每个测试运行时,它们都会返回GoogleTest作为名称。我希望能够将每个结果附加到它运行的浏览器中。将是最好的方法
Run Selenium tests in multiple browsers one after another from C# NUnit
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Chrome;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium.Support.UI;
namespace UnitTestProject1
{
[TestFixture(typeof(FirefoxDriver))]
[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public class agentLogin<TWebDriver> where TWebDriver : IWebDriver, new()
{
private IWebDriver driver;
[SetUp]
public void CreateDriver () {
this.driver = new TWebDriver();
}
[Test]
public void agentLogin_Smoke() {
driver.Url = "http://dev.URL.com/Login/Index.aspx";
Assert.IsTrue(driver.FindElement(By.Id("lblHeader")).Displayed);
//Agent Login name
var agentLogin = driver.FindElement(By.Id("tbLoginName"));
agentLogin.Clear();
agentLogin.SendKeys("userID");