コード例 #1
0
        public void TestMethodCallStack()
        {
            var myLogger = new Stf.Utilities.StfLogger
            {
                FileName = @"c:\temp\unittestlogger_TestMethodCallStack.html",
                LogLevel = LogLevel.Internal
            };

            myLogger.LogInfo("NameOfFunction_L0A");
            myLogger.LogInfo("NameOfFunction_L0B");

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunction_L1");
            myLogger.LogInfo("NameOfFunction_L1A");
            myLogger.LogInfo("NameOfFunction_L1B");

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunction_L2");
            myLogger.LogInfo("NameOfFunction_L2A");
            myLogger.LogInfo("NameOfFunction_L2B");

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunction_L3");
            myLogger.LogInfo("NameOfFunction_L3A");
            myLogger.LogInfo("NameOfFunction_L3B");

            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunction_L3");
            myLogger.LogInfo("NameOfFunction_L2A");
            myLogger.LogInfo("NameOfFunction_L2B");

            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunction_L2");
            myLogger.LogInfo("NameOfFunction_L1A");
            myLogger.LogInfo("NameOfFunction_L1B");

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunction_L2");
            myLogger.LogInfo("NameOfFunction_L2A");
            myLogger.LogInfo("NameOfFunction_L2B");

            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunction_L2");
            myLogger.LogInfo("NameOfFunction_L1A");
            myLogger.LogInfo("NameOfFunction_L1B");

            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunction_L1");
            myLogger.LogInfo("NameOfFunction_L0A");
            myLogger.LogInfo("NameOfFunction_L0B");
        }
コード例 #2
0
        public void TestMethodAllLogType()
        {
            var myLogger = new Stf.Utilities.StfLogger
            {
                FileName = @"c:\temp\unittestlogger_TestMethodAllLogType.html",
                LogLevel = LogLevel.Internal
            };

            myLogger.LogError("LogError");
            myLogger.LogWarning("LogWarning");
            myLogger.LogInfo("LogInfo");
            myLogger.LogDebug("LogDebug");

            // normal logging functions - models and adapters
            myLogger.LogTrace("LogTrace");
            myLogger.LogInternal("LogInternal");

            // Header logging functions - testscripts
            myLogger.LogHeader("LogHeader");
            myLogger.LogSubHeader("LogSubHeader");

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunction", new[] { "arg1", "arg2" }, new object[] { null });
            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunction", 42);

            myLogger.LogFunctionEnter(LogLevel.Info, "Int", "NameOfFunctionShort");
            myLogger.LogFunctionExit(LogLevel.Info, "NameOfFunctionShort");

            // used solely by Assert functions
            myLogger.LogPass("testStepName LogPass", "LogPass");
            myLogger.LogFail("testStepName LogFail", "LogFail");

            myLogger.LogKeyValue("SomeKey", "SomeValue", "LogKeyValue");

            myLogger.LogGet(LogLevel.Info, "MyTestProperty", myLogger);
            myLogger.LogSet(LogLevel.Info, "MyTestProperty", myLogger);

            myLogger.LogAutomationIdObject(LogLevel.Internal, myLogger, "Using myLogger as AID for test");

            myLogger.SetRunStatus();
        }