public void Init(TestConfig testConfig)
        {
            bool consoleLogger = false;
            bool fileLogger = true;
            bool.TryParse(testConfig.TestParams["consolelogger"], out consoleLogger);
            bool.TryParse(testConfig.TestParams["filelogger"], out fileLogger);

            string logfileName = testConfig.TestParams["logfilename"];

            if (consoleLogger)
            {
                Loggers.Add(new ConsoleLogger());
            }

            if (fileLogger)
            {
                string fileNameString = logfileName + ".txt";
                Loggers.Add(new FileLogger(fileNameString));
            }

            bool.TryParse(testConfig.TestParams["loginfo"], out LogInfo);
            bool.TryParse(testConfig.TestParams["logverbose"], out LogVerbose);
            bool.TryParse(testConfig.TestParams["logerror"], out LogError);
            bool.TryParse(testConfig.TestParams["logwarning"], out LogWarning);
        }
Beispiel #2
0
        public void Init(TestConfig testConfig)
        {
            bool consoleLogger = false;
            bool fileLogger = true;
            bool.TryParse(testConfig.TestParams["consolelogger"], out consoleLogger);
            bool.TryParse(testConfig.TestParams["filelogger"], out fileLogger);

            string logfilePrefix =testConfig.TestParams["logfilename"];

            if (consoleLogger)
            {
                Loggers.Add(new ConsoleLogger());
            }
            if (fileLogger)
            {
                string fileNameString = logfilePrefix + Environment.UserName + "_" + Environment.MachineName + " " + DateTime.Now.ToString().Replace('/', '-').Replace(':', '_') + ".txt";
                Loggers.Add(new FileLogger(fileNameString));
                
            }


            bool.TryParse(testConfig.TestParams["loginfo"], out LogInfo);
            bool.TryParse(testConfig.TestParams["logverbose"], out LogVerbose);
            bool.TryParse(testConfig.TestParams["logerror"], out LogError);
            bool.TryParse(testConfig.TestParams["logwarning"], out LogWarning);


        }
 public static void Init(string testDataFile)
 {
     Data = new TestConfig(testDataFile);
     Logger = new TestLogger(Data);
     FailedCases = new List<string>();
     SkippedCases = new List<string>();
 }
 public TestLogger(TestConfig testConfig)
 {
     Loggers = new List<ILogger>();
     Init(testConfig);
 }