예제 #1
0
        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());
            }
        }
예제 #2
0
파일: Logger.cs 프로젝트: lwiechec/BizUnit
#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");
                }
            }
        }
예제 #3
0
 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");
         }
     }
 }
예제 #4
0
 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));
     }
 }
예제 #5
0
파일: Logger.cs 프로젝트: lwiechec/BizUnit
#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));
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        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/*");
        }
예제 #8
0
        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;
        }
예제 #9
0
        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);
        }
예제 #10
0
        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());
            }
        }
예제 #11
0
        public BizUnit(Stream configStream, TestGroupPhase testGroupPhase, Context ctx)
        {
            ArgumentValidation.CheckForNullReference(configStream, "configStream");
            ArgumentValidation.CheckForNullReference(testGroupPhase, "_testGroupPhase");
            ArgumentValidation.CheckForNullReference(ctx, "ctx");

            LoadXmlFromStreamAndInit(configStream, testGroupPhase, ctx);
        }
예제 #12
0
        public BizUnit(string configFile, TestGroupPhase testGroupPhase, Context ctx)
        {
            ArgumentValidation.CheckForNullReference(configFile, "configFile");
            ArgumentValidation.CheckForNullReference(testGroupPhase, "_testGroupPhase");
            ArgumentValidation.CheckForNullReference(ctx, "ctx");

            LoadXmlFromFileAndInit(configFile, testGroupPhase, ctx);
        }
예제 #13
0
파일: Logger.cs 프로젝트: RobBowman/BizUnit
 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");
         }
     }
 }
예제 #14
0
파일: Logger.cs 프로젝트: RobBowman/BizUnit
	    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));
            }
        }