Until now they were runnable by hand only, but it's not an option.
There is a MashupSpecs C# unit test introduced today into Tp.Subversion.Tests.
It's written in C# with using of WebDriver. It opens a web page with javascript unit tests, then gathers results. If any errors acquired then it will fail the build.
Now it's quite simple implementation and may be improved:
[TestFixture] public class MashupSpecs { private IWebDriver _webDriver; [SetUp] public void Init() { _webDriver = new RemoteWebDriver(DesiredCapabilities.Firefox()); _webDriver.Navigate().GoToUrl(string.Format(@"file:///{0}/UI/Tests/index.html", AppDomain.CurrentDomain.BaseDirectory)); } [TearDown] public void Destroy() { _webDriver.Close(); _webDriver.Dispose(); } [Test] public void ShouldRunAllTests() { new WebDriverWait(_webDriver, TimeSpan.FromSeconds(10)).Until(x => x.FindElement(By.Id("qunit-banner")).GetAttribute("class") != string.Empty); var failedTests = _webDriver.FindElements(By.CssSelector("#qunit-tests>.fail")); failedTests.Should(Be.Empty, new FailedTestCollection(failedTests).ToString()); } } public class FailedTestCollection : ReadOnlyCollection<IWebElement> { public FailedTestCollection(IList<IWebElement> list) : base(list) {} public override string ToString() { var result = new StringBuilder(); foreach (var webElement in Items) { result.AppendLine(webElement.Text); result.AppendLine(); } return result.ToString(); } }
Комментариев нет:
Отправить комментарий