//----< demonstrate Test Harness Prototype >--------------------- static void Main(string[] args) { Console.WriteLine("============================this is the testharness===================="); Console.WriteLine("\nthe testharness can load and test the libraries, meet the requirement 9"); Receiver testreceiver = new Receiver(); testreceiver.CreateHost("http://localhost:3000"); while (true) { try { CommMessage msg = testreceiver.GetMessage(); Console.WriteLine("\n=================start new test========================"); Console.WriteLine("\nreceive test request from the child builder"); Console.WriteLine("\nthe library need to be test is:{0}", msg.Body); Tester tstr = new Tester(); Thread t = tstr.SelectConfigAndRun("TestLibraries", msg.Body); Console.WriteLine(); t.Join(); Sender logsender = new Sender(); logsender.CreateChannel("http://localhost:2017"); logsender.postFile(msg.Body + "testlog.txt", TestharnessEnvironment.testlogpath, 1024, RepoEnvironment.testlogpath);//send log to the repository tstr.ShowTestResults(); tstr.UnloadTestDomain(); } catch { continue; } } }
//----< demonstrate Test Harness Prototype >--------------------- static void Main(string[] args) { Console.Write( "\n Tester, ver 1.1 - Demonstrates Prototype TestHarness" ); Console.Write( "\n ======================================================" ); Tester tstr = new Tester(); Thread t = tstr.SelectConfigAndRun("TestLibraries"); t.Join(); tstr.ShowTestResults(); tstr.UnloadTestDomain(); // Console.ReadLine(); }
void initializeDispatcher() { Func <CommMessage, CommMessage> testRequest = (CommMessage msg) => { msg.show(); //create the temp dir string TestTempFileDir = "../../../TestStorage/" + msg.arguments[0] + "/"; if (!System.IO.Directory.Exists(TestTempFileDir)) { System.IO.Directory.CreateDirectory(TestTempFileDir); } CommMessage reply = new CommMessage(CommMessage.MessageType.reply); reply.to = "http://localhost:5270/IPluggableComm"; reply.from = msg.to; reply.command = "getTestFiles"; reply.arguments.Add(msg.arguments[0]); return(reply); }; messageDispatcher["testRequest"] = testRequest; Func <CommMessage, CommMessage> testFileOK = (CommMessage msg) => { msg.show(); //do Test string TestTempFileDir = "../../../TestStorage/" + msg.arguments[0] + "/"; TestRequest.TestRequest TR = new TestRequest.TestRequest(); TR.unwrap(TestTempFileDir + "TestRequest" + msg.arguments[0] + ".xml", false); Tester tstr = new Tester(); Thread t = tstr.SelectConfigAndRun(TestTempFileDir); t.Join(); bool Testresult = tstr.ShowTestResults(); CommMessage reply = new CommMessage(CommMessage.MessageType.reply); reply.to = "http://localhost:5261/IPluggableComm"; reply.from = msg.to; reply.command = "testResult"; reply.arguments.Add(msg.arguments[0]); reply.arguments.Add(Testresult?"Success":"Fail"); return(reply); }; messageDispatcher["testFileOK"] = testFileOK; }
//----< demonstrate Test Harness Prototype >--------------------- static void Main(string[] args) { Console.Title = "TestHarness"; Console.Write( "\n Tester, ver 1.1 - Demonstrates Prototype TestHarness" ); Console.Write( "\n ======================================================" ); Tester tstr = new Tester(); #if (TEST_TESTER) tstr.currentFileStorage = "../../testStub"; tstr.SelectConfigAndRun(tstr.currentFileStorage); return; #endif tstr.testerLoop(); }
void OneNewTRMessageHandler(CommMessage msg) { try { Tester tst = new Tester(); Thread t = tst.SelectConfigAndRun(THStorage); t.Join(); tst.ShowTestResults(); tst.UnloadTestDomain(); string output = tst.results_; sendToRepo(output, msg.command); DelectDir(THStorage); Console.WriteLine("\n"); Console.Write(output); } catch (Exception ex) { Console.Write("\n\n The error reason in OnNewTRMessageHandler is {0}\n\n", ex.Message); } }
// called when all the files are transferred // and testing has to be initiated. public void TransferComplete(string path) { Tester tstr = new Tester(); Thread t = tstr.SelectConfigAndRun(path); }