private void LoadXamlTestCaseAndInit(TestCase testCase, TestGroupPhase phase, Context ctx) { ArgumentValidation.CheckForNullReference(testCase, "testCase"); // ctx - optional if (null != ctx) { _context = ctx; _context.Initialize(this); } else { _context = new Context(this); _logger = _context.Logger; } _xamlTestCase = testCase; _testGroupPhase = phase; _testName = testCase.Name; DateTime now = DateTime.Now; // Validate test case... testCase.Validate(_context); if (phase == TestGroupPhase.Unknown) { _logger.TestStart(_testName, now, GetUserName()); _context.Add(BizUnitTestCaseStartTime, now, true); } else { _logger.TestGroupStart(testCase.Name, phase, now, GetUserName()); } }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member 'Logger.TestGroupEnd(TestGroupPhase, DateTime, Exception)' public void TestGroupEnd(TestGroupPhase testGroupPhase, DateTime time, Exception executionException) #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member 'Logger.TestGroupEnd(TestGroupPhase, DateTime, Exception)' { if (testGroupPhase == TestGroupPhase.TestGroupSetup) { if (null != executionException) { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P S E T U P F A I L E D ******"); } else { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P S E T U P P A S S"); } } else { if (null != executionException) { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P T E A R D O W N F A I L E D ******"); } else { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P T E A R D O W N P A S S"); } } }
public void TestGroupEnd(TestGroupPhase testGroupPhase, DateTime time, Exception executionException) { if (testGroupPhase == TestGroupPhase.TestGroupSetup) { if (null != executionException) { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P S E T U P F A I L E D ******"); } else { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P S E T U P P A S S"); } } else { if (null != executionException) { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P T E A R D O W N F A I L E D ******"); } else { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P T E A R D O W N P A S S"); } } }
public void TestGroupStart(string testGroupName, TestGroupPhase testGroupPhase, DateTime time, string userName) { if (!InfoLog) { return; } if (testGroupPhase == TestGroupPhase.TestGroupSetup) { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P S E T U P"); WriteLine(" "); WriteLine(string.Format("Test Group Setup: {0} started @ {1} by {2}", testGroupName, FormatDate(time), userName)); WriteLine(new string('-', 79)); } else { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P T E A R D O W N"); WriteLine(" "); WriteLine(string.Format("Test Group Tear Down: {0} completed @ {1}", testGroupName, FormatDate(time))); WriteLine(new string('-', 79)); } }
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member 'Logger.TestGroupStart(string, TestGroupPhase, DateTime, string)' public void TestGroupStart(string testGroupName, TestGroupPhase testGroupPhase, DateTime time, string userName) #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member 'Logger.TestGroupStart(string, TestGroupPhase, DateTime, string)' { if (testGroupPhase == TestGroupPhase.TestGroupSetup) { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P S E T U P"); WriteLine(" "); WriteLine(string.Format("Test Group Setup: {0} started @ {1} by {2}", testGroupName, FormatDate(time), userName)); WriteLine(new string('-', 79)); } else { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P T E A R D O W N"); WriteLine(" "); WriteLine(string.Format("Test Group Tear Down: {0} completed @ {1}", testGroupName, FormatDate(time))); WriteLine(new string('-', 79)); } }
private void LoadXmlFromStreamAndInit( Stream configStream, TestGroupPhase phase, Context ctx) { var testConfig = new XmlDocument(); try { var sr = new StreamReader(configStream); testConfig.LoadXml(sr.ReadToEnd()); } catch (Exception ex) { _logger.Log(LogLevel.ERROR, "Failed to load the step configuration stream, exception: {0}", ex.ToString()); throw; } Init(testConfig, phase, ctx); }
private void Init( XmlDocument testConfig, TestGroupPhase phase, Context ctx) { if (null != ctx) { _context = ctx; _context.Initialize(this); } else { _context = new Context(this); _logger = _context.Logger; } _testGroupPhase = phase; // Get test name... XmlNode nameNode = testConfig.SelectSingleNode("/TestCase/@_testName"); if (null != nameNode) { _testName = nameNode.Value; _context.Add(BizUnitTestCaseName, _testName, true); } DateTime now = DateTime.Now; if (phase == TestGroupPhase.Unknown) { _logger.TestStart(_testName, now, GetUserName()); _context.Add(BizUnitTestCaseStartTime, now, true); } else { _logger.TestGroupStart(_testName, phase, now, GetUserName()); } // Get test setup / execution / teardown steps _setupSteps = testConfig.SelectNodes("/TestCase/TestSetup/*"); _executeSteps = testConfig.SelectNodes("/TestCase/TestExecution/*"); _teardownSteps = testConfig.SelectNodes("/TestCase/TestCleanup/*"); }
private void LoadObjectModelTestCaseAndInit(BizUnitTestCase testCase, TestGroupPhase phase, Context ctx) { if (null != ctx) { _context = ctx; _context.Initialize(this); } else { _context = new Context(this); _logger = _context.Logger; } _testGroupPhase = phase; _testName = testCase.Name; DateTime now = DateTime.Now; if (phase == TestGroupPhase.Unknown) { _logger.TestStart(_testName, now, GetUserName()); _context.Add(BizUnitTestCaseStartTime, now); } else { _logger.TestGroupStart(_testName, phase, now, GetUserName()); } _testCaseObjectModel = testCase; }
private void LoadXmlFromFileAndInit( string configFile, TestGroupPhase phase, Context ctx) { var testConfig = new XmlDocument(); try { testConfig.Load(configFile); } catch (Exception ex) { _logger.Log(LogLevel.ERROR, "Failed to load the step configuration file: \"{0}\", exception: {1}", configFile, ex.ToString()); throw; } Init(testConfig, phase, ctx); }
private void LoadXamlTestCaseAndInit(TestCase testCase, TestGroupPhase phase, Context ctx) { ArgumentValidation.CheckForNullReference(testCase, "testCase"); // ctx - optional if (null != ctx) { _context = ctx; _context.Initialize(this); } else { _context = new Context(this); _logger = _context.Logger; } _xamlTestCase = testCase; _testGroupPhase = phase; _testName = testCase.Name; DateTime now = DateTime.Now; // Validate test case... testCase.Validate(_context); if (phase == TestGroupPhase.Unknown) { _logger.TestStart(_testName, now, GetUserName()); _context.Add(BizUnitTestCaseStartTime, now, true); } else { _logger.TestGroupStart(testCase.Name, phase, now, GetUserName()); } }
public BizUnit(Stream configStream, TestGroupPhase testGroupPhase, Context ctx) { ArgumentValidation.CheckForNullReference(configStream, "configStream"); ArgumentValidation.CheckForNullReference(testGroupPhase, "_testGroupPhase"); ArgumentValidation.CheckForNullReference(ctx, "ctx"); LoadXmlFromStreamAndInit(configStream, testGroupPhase, ctx); }
public BizUnit(string configFile, TestGroupPhase testGroupPhase, Context ctx) { ArgumentValidation.CheckForNullReference(configFile, "configFile"); ArgumentValidation.CheckForNullReference(testGroupPhase, "_testGroupPhase"); ArgumentValidation.CheckForNullReference(ctx, "ctx"); LoadXmlFromFileAndInit(configFile, testGroupPhase, ctx); }
public void TestGroupEnd(TestGroupPhase testGroupPhase, DateTime time, Exception executionException) { if (testGroupPhase == TestGroupPhase.TestGroupSetup) { if (null != executionException) { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P S E T U P F A I L E D ******"); } else { WriteLine(string.Format("Test Group Setup completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P S E T U P P A S S"); } } else { if (null != executionException) { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" ****** T E S T G R O U P T E A R D O W N F A I L E D ******"); } else { WriteLine(string.Format("Test Group Tear Down completed @ {0}", FormatDate(time))); WriteLine(" T E S T G R O U P T E A R D O W N P A S S"); } } }
public void TestGroupStart(string testGroupName, TestGroupPhase testGroupPhase, DateTime time, string userName) { if (testGroupPhase == TestGroupPhase.TestGroupSetup) { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P S E T U P"); WriteLine(" "); WriteLine(string.Format("Test Group Setup: {0} started @ {1} by {2}", testGroupName, FormatDate(time), userName)); WriteLine(new string('-', 79)); } else { WriteLine(" "); WriteLine(new string('-', 79)); WriteLine(" T E S T G R O U P T E A R D O W N"); WriteLine(" "); WriteLine(string.Format("Test Group Tear Down: {0} completed @ {1}", testGroupName, FormatDate(time))); WriteLine(new string('-', 79)); } }