コード例 #1
0
        /// <summary>
        /// Runs the JSUnit test fixture.  This method blocks until the results
        /// are returned from JSUnit or a timeout occurs.
        /// </summary>
        /// <remarks>
        /// Assumes the web server serving the JSUnit fixture page is already running
        /// if one is required.
        /// </remarks>
        /// <param name="jsUnitRunnerUrl">
        /// The full URL of the JSUnit runner html page along with any querystring params
        /// </param>
        /// <param name="timeoutInMilliseconds">
        /// The maximum amount of time in milliseconds to wait for a result.
        /// </param>
        /// <returns><c>true</c> if no test errors occurred.</returns>
        public bool RunFixture([NotNull] Uri jsUnitRunnerUrl, int timeoutInMilliseconds)
        {
            // this call is sync, so no results ever get posted...
            webBrowser.OpenUrl(jsUnitRunnerUrl);

            string rawResults = resultListener.WaitForResults(timeoutInMilliseconds);

            webBrowser.Close();

            errors = resultParser.ParseJsUnitErrors(rawResults);
            return(errors.Count == 0);
        }
コード例 #2
0
        public void Should_open_browser_get_results_then_close_browser()
        {
            var fixtureUrl = new Uri("http://localhost:9033/JsUnitRunner.html");

            using (mocks.Ordered())
            {
                browser.OpenUrl(fixtureUrl);
                Expect.Call(resultListener.WaitForResults(5000)).Return("Raw JSUnit results");
                browser.Close();
            }

            SetupResult.For(resultParser.ParseJsUnitErrors("Raw JSUnit results"))
            .IgnoreArguments()
            .Return(new List <JsUnitErrorResult>());

            mocks.ReplayAll();

            fixtureRunner.RunFixture(fixtureUrl, 5000);

            mocks.VerifyAll();
        }