public HtmlImageResultFormatter(Configuration configuration, ITestResults results, HtmlResourceSet htmlResourceSet) { this.configuration = configuration; this.results = results; this.htmlResourceSet = htmlResourceSet; this.xmlns = HtmlNamespace.Xhtml; }
public WordScenarioOutlineFormatter(WordStepFormatter wordStepFormatter, WordTableFormatter wordTableFormatter, Configuration configuration, ITestResults testResults) { this.wordStepFormatter = wordStepFormatter; this.wordTableFormatter = wordTableFormatter; this.configuration = configuration; this.testResults = testResults; }
//----< save results and logs in Repository >-------------------- bool saveResultsAndLogs(ITestResults testResults) { string logName = testResults.testKey + ".txt"; System.IO.StreamWriter sr = null; try { sr = new System.IO.StreamWriter(System.IO.Path.Combine(repoPath_, logName)); sr.WriteLine(logName); foreach (ITestResult test in testResults.testResults) { sr.WriteLine("-----------------------------"); sr.WriteLine(test.testName); sr.WriteLine(test.testResult); sr.WriteLine(test.testLog); } sr.WriteLine("-----------------------------"); } catch (Exception message) { Console.WriteLine("Error message", message); sr.Close(); return(false); } sr.Close(); this.comm.sndr.channel = Sender.CreateServiceChannel("http://localhost:8082/StreamService"); this.comm.sndr.uploadFile(logName); //sending log to repository Console.WriteLine("\n**********************************************************************"); Console.WriteLine("\nDemonstrating requirement 7 ,saving logs to Repository"); return(true); }
protected internal override void HandleResult(string homepageHtml, ITestResults results) { Regex regex = new Regex(Regex.Escape(guid1) + "(.*?)" + Regex.Escape(guid2)); SimpleHtmlParser parser = new SimpleHtmlParser(homepageHtml); for (Element e = parser.Next(); e != null; e = parser.Next()) { if (e is Text) { Match m = regex.Match(e.ToString()); if (m.Success) { string str = m.Groups[1].Value; if (str == HtmlUtils.EscapeEntities(TEST_STRING)) { results.AddResult("requiresHtmlTitles", YES); } else if (str == HtmlUtils.EscapeEntities(HtmlUtils.EscapeEntities(TEST_STRING))) { results.AddResult("requiresHtmlTitles", NO); } else { results.AddResult("requiresHtmlTitles", "[ERROR] (value was: " + str + ")"); } return; } } } throw new InvalidOperationException("Title encoding test failed--title was not detected"); }
//----< save results and logs in Repository >-------------------- bool saveResultsAndLogs(ITestResults testResults, string dir) { string logName = testResults.testKey + ".txt"; System.IO.StreamWriter sr = null; try { sr = new System.IO.StreamWriter(System.IO.Path.Combine(dir, logName)); sr.WriteLine(logName); foreach (ITestResult test in testResults.testResults) { sr.WriteLine("-----------------------------"); sr.WriteLine(test.testName); sr.WriteLine(test.testResult); sr.WriteLine(test.testLog); } sr.WriteLine("-----------------------------"); } catch { sr.Close(); return(false); } sr.Close(); string torepo = "sending the log file" + logName + "to Repo using filestream service - Req#7"; torepo.title(); uploadFile(logName, "http://localhost:8080/RepoIService", dir); return(true); }
void RunTestThrdProc(Message msg) // msg= testreqeust message { List <TestInfo> testInfoList = new List <TestInfo>(); XDocument xdoc = XParse(testInfoList, msg.body); xdoc.ShowXMLBody(); AppDomain ad = ChildDomain(); ILoadAndTest ilt = installLoader(ad); // LoadAndTest proxy foreach (var tstinfomsg in testInfoList) { ilt.LoadTests(tstinfomsg); // pass testInfo msg to proxy method } ITestResults trs = cb_.GetMessage(); // cb is callback object that returns testResults trs.testKey = msg.author + "_" + trs.dateTime.ToString("yyyy-mm-dd-hh-mm-ss-ffff") + "_ThreadID" + Thread.CurrentThread.ManagedThreadId + ".txt"; Message resultMsg = MakeTestRsultMessage(trs, msg); //------ logger to Repository ------------- streamproxy.writeLog(resultMsg); // ------reply testResult msg to client --------- this.comm.sndr.PostMessage(resultMsg); testInfoList.Clear(); AppDomain.Unload(ad); }
//----< main activity of TestHarness >--------------------------- public void processMessages() //process the message, start a test in a thread, the maximum of thread is 8. { AppDomain main = AppDomain.CurrentDomain; Console.Write("\n Starting in AppDomain " + main.FriendlyName + "\n"); ThreadStart doTests = () => { Message testRequest = inQ_.deQ(); if (testRequest.body == "quit") { inQ_.enQ(testRequest); //enqueue a test request. return; } ITestResults testResults = runTests(testRequest); lock (sync_) { client_.sendResults(makeTestResultsMessage(testResults)); } }; int numThreads = 8; Console.Write("\n Creating AppDomain thread, We Support Multi-Thread Test Request. --------Project 4. Req 2"); for (int i = 0; i < numThreads; ++i) //start thread { Thread t = new Thread(doTests); threads_.Add(t); t.Start(); } }
public WordScenarioFormatter(WordStepFormatter wordStepFormatter, Configuration configuration, ITestResults nunitResults) { this.wordStepFormatter = wordStepFormatter; this.configuration = configuration; this.nunitResults = nunitResults; }
public WordScenarioOutlineFormatter(WordStepFormatter wordStepFormatter, WordTableFormatter wordTableFormatter, IConfiguration configuration, ITestResults testResults) { this.wordStepFormatter = wordStepFormatter; this.wordTableFormatter = wordTableFormatter; this.configuration = configuration; this.testResults = testResults; }
public DitaScenarioFormatter(Configuration configuration, ITestResults nunitResults, DitaStepFormatter ditaStepFormatter) { this.configuration = configuration; this.nunitResults = nunitResults; this.ditaStepFormatter = ditaStepFormatter; }
//Save results and logs in Repository bool saveResultsAndLogs(ITestResults testResults) { Console.WriteLine("\n------------------------Requirement 7 - Line 277 TestHarness.cs--------------------"); Console.WriteLine("Storing logs in the repository"); string logName = testResults.testKey + ".txt"; StreamWriter sr = null; try { sr = new System.IO.StreamWriter(System.IO.Path.Combine(repoPath_, logName)); sr.WriteLine(logName); foreach (ITestResult test in testResults.testResults) { sr.WriteLine("-----------------------------"); sr.WriteLine(test.testName); sr.WriteLine(test.testResult); sr.WriteLine(test.testLog); } sr.WriteLine("-----------------------------"); } catch { sr.Close(); return(false); } sr.Close(); return(true); }
protected internal override void HandleResult(OpenLiveWriter.Extensibility.BlogClient.BlogPost blogPost, ITestResults results) { if (blogPost.Categories.Length == 2) results.AddResult("supportsMultipleCategories", YES); else results.AddResult("supportsMultipleCategories", NO); }
public JsonDocumentationBuilder(IConfiguration configuration, ITestResults testResults, IFileSystem fileSystem, ILanguageServicesRegistry languageServicesRegistry) { this.configuration = configuration; this.testResults = testResults; this.fileSystem = fileSystem; this.languageServicesRegistry = languageServicesRegistry; }
protected internal override void HandleResult(string homepageHtml, ITestResults results) { foreach (PostTest test in tests) { test.HandleResult(homepageHtml, results); } }
protected internal override void HandleResult(string homepageHtml, ITestResults results) { Regex regex = new Regex(Regex.Escape(guid1) + "(.*?)" + Regex.Escape(guid2)); SimpleHtmlParser parser = new SimpleHtmlParser(homepageHtml); for (Element e = parser.Next(); e != null; e = parser.Next()) { if (e is Text) { Match m = regex.Match(e.ToString()); if (m.Success) { string str = m.Groups[1].Value; if (str == HtmlUtils.EscapeEntities(TEST_STRING)) results.AddResult("requiresHtmlTitles", YES); else if (str == HtmlUtils.EscapeEntities(HtmlUtils.EscapeEntities(TEST_STRING))) results.AddResult("requiresHtmlTitles", NO); else results.AddResult("requiresHtmlTitles", "[ERROR] (value was: " + str + ")"); return; } } } throw new InvalidOperationException("Title encoding test failed--title was not detected"); }
public void processMessages() { AppDomain main = AppDomain.CurrentDomain; Console.Write("\n Starting in AppDomain " + main.FriendlyName + "\n"); ThreadStart doTests = () => { Message testRequest = inQ_.deQ(); if (testRequest.body == "quit") { inQ_.enQ(testRequest); return; } hrt2.Start(); ITestResults testResults = runTests(testRequest); hrt2.Stop(); lock (sync_) { comm.sndr.PostMessage(makeTestResultsMessage(testResults, testRequest)); } Console.Write("\n REQ 12 - Time taken for test Execution {0} is {1}", testRequest.clientName, hrt2.ElapsedMicroseconds); }; Console.Write("\n Creating AppDomain thread"); int numThreads = 8; for (int i = 0; i < numThreads; ++i) { Thread t = new Thread(doTests); threads_.Add(t); t.Start(); } }
bool saveResultsAndLogs(ITestResults testResults) { string logName = testResults.testKey + ".txt"; System.IO.StreamWriter sr = null; try { sr = new System.IO.StreamWriter(System.IO.Path.Combine(repoPath_, logName)); sr.WriteLine(logName); foreach (ITestResult test in testResults.testResults) { sr.WriteLine("-----------------------------"); sr.WriteLine(test.testName); sr.WriteLine(test.testResult); sr.WriteLine(test.testLog); } sr.WriteLine("-----------------------------"); } catch { sr.Close(); return(false); } sr.Close(); return(true); }
ITestResults runTests(Message testRequest) { RequestInfo rqi = processRequestAndLoadFiles(testRequest); AppDomain ad = createChildAppDomain(); ILoadAndTest ldandtst = installLoader(ad); ITestResults tr = null; if (ldandtst != null) { //ldandtst.setCallback(cb_); tr = ldandtst.test(rqi); tr.testKey = localDir_; DLog.flush(); //DLog.pause(true); RLog.putLine(); RLog.write("\n test results are:"); RLog.write("\n - test Identifier: " + tr.testKey); RLog.write("\n - test DateTime: " + tr.dateTime); foreach (ITestResult test in tr.testResults) { RLog.write("\n --------------------------------------"); RLog.write("\n test name: " + test.testName); RLog.write("\n test result: " + test.testResult); RLog.write("\n test log: " + test.testLog); } RLog.write("\n --------------------------------------"); } RLog.putLine(); RLog.flush(); //DLog.pause(false); if (saveResultsAndLogs(tr)) { RLog.write("\n saved test results and logs in Repository - Req #5, Req #7, Req #8\n"); } else { RLog.write("\n failed to save test results and logs in Repository\n"); } DLog.putLine(); DLog.write("\n removing test directory \"" + localDir_ + "\""); try { System.IO.Directory.Delete(localDir_, true); } catch (Exception ex) { DLog.write("\n could not remove directory"); DLog.write("\n " + ex.Message); } // unloading ChildDomain, and so unloading the library DLog.write("\n unloading: \"" + ad.FriendlyName + "\"\n"); AppDomain.Unload(ad); DLog.stop(); return(tr); }
public HtmlImageResultFormatter(Configuration configuration, ITestResults results, HtmlResourceSet htmlResourceSet) { this.configuration = configuration; this.results = results; this.htmlResourceSet = htmlResourceSet; xmlns = HtmlNamespace.Xhtml; }
public ExcelScenarioFormatter(ExcelStepFormatter excelStepFormatter, Configuration configuration, ITestResults testResults) { this.excelStepFormatter = excelStepFormatter; this.configuration = configuration; this.testResults = testResults; }
public WordScenarioOutlineFormatter(WordStepFormatter wordStepFormatter, WordTableFormatter wordTableFormatter, IConfiguration configuration, ITestResults testResults, ILanguageServicesRegistry languageServicesRegistry) { this.wordStepFormatter = wordStepFormatter; this.wordTableFormatter = wordTableFormatter; this.configuration = configuration; this.testResults = testResults; this.languageServicesRegistry = languageServicesRegistry; }
public TotalCoverageResults(ITestResults testResults, IDictionary <string, object> coverageResults) { Trace.Assert(testResults != null); Trace.Assert(coverageResults != null); this.testResults = testResults; this.coverageResults = coverageResults; }
public WordFeatureFormatter(WordScenarioFormatter wordScenarioFormatter, WordScenarioOutlineFormatter wordScenarioOutlineFormatter, WordStyleApplicator wordStyleApplicator, Configuration configuration, ITestResults nunitResults) { this.wordScenarioFormatter = wordScenarioFormatter; this.wordScenarioOutlineFormatter = wordScenarioOutlineFormatter; this.wordStyleApplicator = wordStyleApplicator; this.configuration = configuration; this.nunitResults = nunitResults; }
public TotalCoverageResults(ITestResults testResults, IDictionary<string, object> coverageResults) { Trace.Assert(testResults != null); Trace.Assert(coverageResults != null); this.testResults = testResults; this.coverageResults = coverageResults; }
public DitaFeatureFormatter(Configuration configuration, DitaScenarioFormatter ditaScenarioFormatter, DitaScenarioOutlineFormatter ditaScenarioOutlineFormatter, DitaMapPathGenerator ditaMapPathGenerator, ITestResults nunitResults) { this.configuration = configuration; this.ditaScenarioFormatter = ditaScenarioFormatter; this.ditaScenarioOutlineFormatter = ditaScenarioOutlineFormatter; this.ditaMapPathGenerator = ditaMapPathGenerator; this.nunitResults = nunitResults; }
public TestReport([NotNull] ITestMetadata test, [NotNull] ITestResults results) { Assert.ArgumentNotNull(test, nameof(test)); Assert.ArgumentNotNull(results, nameof(results)); Owner = test; _Results = results; }
private void ExtractResultsFromTest(ITestResults result) { Trace.Assert(result != null); Trace.Assert(!String.IsNullOrWhiteSpace(result.FixtureName)); Array.ForEach(result.Passed.ToArray(), name => AddPassedTest(result.FixtureName + " - " + name)); Array.ForEach(result.Failed.ToArray(), name => AddFailedTest(result.FixtureName + " - " + name)); }
public override void HandleContentResult(string result, ITestResults results) { if (result == null) throw new InvalidOperationException("Embed test markers were not found!"); else if (result.ToLowerInvariant().Contains("<embed")) results.AddResult("supportsEmbeds", YES); else results.AddResult("supportsEmbeds", NO); }
private static void SetResultsForIndividualScenariosUnderFeature(FeatureNode featureTreeNode, ITestResults testResults) { foreach (var scenario in featureTreeNode.Feature.FeatureElements) { scenario.Result = scenario.GetType().Name == "Scenario" ? testResults.GetScenarioResult(scenario as Scenario) : testResults.GetScenarioOutlineResult(scenario as ScenarioOutline); } }
public ExcelFeatureFormatter(ExcelScenarioFormatter excelScenarioFormatter, ExcelScenarioOutlineFormatter excelScenarioOutlineFormatter, Configuration configuration, ITestResults testResults) { this.excelScenarioFormatter = excelScenarioFormatter; this.excelScenarioOutlineFormatter = excelScenarioOutlineFormatter; this.configuration = configuration; this.testResults = testResults; }
public static void WriteFinalToFile(ITestResults foo, string fileName) { var serializer = new XmlSerializer(foo.GetType()); using (var writer = new StreamWriter(string.Format("{0}{1}.xml", fileName, DateTime.Now.Ticks))) { serializer.Serialize(writer, foo); } }
[Test] public void RunJSFileTest() { using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile)) { ITestResults results = adapter.RunTest(@"resources\simple_closure_tests.js"); Assert.AreEqual(0, results.Failed.Count(), results.ToString()); Assert.AreEqual(66, results.Passed.Count(), results.ToString()); } }
[Test] public void RunSingleTestFile() { using (ITestAdapter adapter = JSNet.QUnit(qUnitJS)) { ITestResults results = adapter.RunTest(@"J:\dev\libs\qunit\test\test.js"); Assert.AreEqual(2, results.Failed.Count()); Assert.AreEqual(23, results.Passed.Count()); } }
[Test] public void TestHtmlFileWithSrcFiles() { using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile)) { ITestResults results = adapter.RunTest(@"resources\test_with_src_files.html"); Assert.AreEqual(0, results.Failed.Count(), results.ToString()); Assert.AreEqual(65, results.Passed.Count(), results.ToString()); } }
[Test] public void RunHtmlFileTest() { using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile)) { ITestResults results = adapter.RunTest(@"J:\dev\Projects\Misc\closure-library\closure\goog\array\array_test.html"); Assert.AreEqual(0, results.Failed.Count(), results.ToString()); Assert.AreEqual(73, results.Passed.Count(), results.ToString()); } }
public static void WriteToFile(ITestResults foo, string fileName) { var serializer = new XmlSerializer(foo.GetType()); var writer = new StreamWriter(string.Format("{0}-{1}.xml", fileName, DateTime.Now.Ticks)); serializer.Serialize(writer, foo); writer.Close(); writer.Dispose(); }
public ExcelScenarioOutlineFormatter( ExcelStepFormatter excelStepFormatter, ExcelTableFormatter excelTableFormatter, IConfiguration configuration, ITestResults testResults) { this.excelStepFormatter = excelStepFormatter; this.excelTableFormatter = excelTableFormatter; this.configuration = configuration; this.testResults = testResults; }
[Test] public void AssertThatTheClosureTestWorksWithoutAnyCoverageStuff() { using (ITestAdapter adapter = JSNet.ClosureLibrary(basejsfile)) { adapter.LoadSourceFile(@"resources\jscoverage\src\jscoverage_source.js"); ITestResults results = adapter.RunTest(@"resources\jscoverage\jscoverage_test.js"); Assert.AreEqual(0, results.Failed.Count(), results.ToString()); Assert.AreEqual(4, results.Passed.Count(), results.ToString()); } }
public override void HandleContentResult(string result, ITestResults results) { if (result == null) { Debug.Fail("Embeds gone"); results.AddResult("supportsEmbeds", "Unknown"); } else if (result.ToLowerInvariant().Contains("<embed")) results.AddResult("supportsEmbeds", YES); else results.AddResult("supportsEmbeds", NO); }
public HtmlScenarioOutlineFormatter( HtmlStepFormatter htmlStepFormatter, HtmlDescriptionFormatter htmlDescriptionFormatter, HtmlTableFormatter htmlTableFormatter, HtmlImageResultFormatter htmlImageResultFormatter, ITestResults testResults) { this.htmlStepFormatter = htmlStepFormatter; this.htmlDescriptionFormatter = htmlDescriptionFormatter; this.htmlTableFormatter = htmlTableFormatter; this.htmlImageResultFormatter = htmlImageResultFormatter; this.testResults = testResults; this.xmlns = HtmlNamespace.Xhtml; }
private IEnumerable<ITestResults> GetSingleTestResults(IConfiguration configuration) { ITestResults[] results; if (configuration.HasTestResults) { results = configuration.TestResultsFiles.Select(this.ConstructSingleTestResult).ToArray(); } else { results = new ITestResults[0]; } return results; }
public WordFeatureFormatter( WordScenarioFormatter wordScenarioFormatter, WordScenarioOutlineFormatter wordScenarioOutlineFormatter, WordStyleApplicator wordStyleApplicator, WordDescriptionFormatter wordDescriptionFormatter, WordBackgroundFormatter wordBackgroundFormatter, IConfiguration configuration, ITestResults testResults) { this.wordScenarioFormatter = wordScenarioFormatter; this.wordScenarioOutlineFormatter = wordScenarioOutlineFormatter; this.wordStyleApplicator = wordStyleApplicator; this.wordDescriptionFormatter = wordDescriptionFormatter; this.wordBackgroundFormatter = wordBackgroundFormatter; this.configuration = configuration; this.testResults = testResults; }
public override void DoTest(BlogRunner.Core.Config.Blog blog, OpenLiveWriter.Extensibility.BlogClient.IBlogClient blogClient, ITestResults results) { BlogPost post = new BlogPost(); post.Contents = "foo"; post.Title = ""; string etag; XmlDocument remotePost; try { string newPostId = blogClient.NewPost(blog.BlogId, post, null, true, out etag, out remotePost); results.AddResult("supportsEmptyTitles", YES); if (CleanUpPosts) blogClient.DeletePost(blog.BlogId, newPostId, true); } catch { results.AddResult("supportsEmptyTitles", NO); } }
public DhtmlDocumentationBuilder(IConfiguration configuration, ITestResults testResults, IFileSystem fileSystem) { this.configuration = configuration; this.testResults = testResults; this.fileSystem = fileSystem; }
private static MultipleTestResults CreateMultipleTestResults(ITestResults testResults1, ITestResults testResults2) { return new TestableMultipleTestResults(new[] { testResults1, testResults2 }); }
protected internal override void HandleResult(string homepageHtml, ITestResults results) { results.AddResult("futurePublishDateWarning", YES); }
protected internal override bool HandleTimeout(TimeoutException te, ITestResults results) { results.AddResult("futurePublishDateWarning", NO); return true; }
private static void SetResultsAtFeatureLevel(FeatureNode featureTreeNode, ITestResults testResults) { featureTreeNode.Feature.Result = testResults.GetFeatureResult(featureTreeNode.Feature); }
public static void WriteToFile(ITestResults foo, string fileName) { XmlSerializer serializer = new XmlSerializer(foo.GetType()); Directory.CreateDirectory(Configuration.NUnitModifiedTestResultLocation); using (var writer = new StreamWriter(string.Format("{0}{1}-{2}.xml", Configuration.NUnitModifiedTestResultLocation, fileName, DateTime.Now.Ticks))) { serializer.Serialize(writer, foo); } }
public JSONDocumentationBuilder(Configuration configuration, ITestResults testResults) { this.configuration = configuration; this.testResults = testResults; }