Пример #1
0
        public void TestMethodSummaryLogger()
        {
            var logDir           = Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @".\Data"));
            var summaryFilename  = Path.Combine(StfTextUtils.GetVariable("Stf_LogDir"), "TestMethodSummaryLogger_SummaryLog.html");
            var oneSummaryLogger = new StfSummaryLogger();

            StfAssert.IsTrue("StfLogger.CreateSummaryLog", oneSummaryLogger.CreateSummaryLog(summaryFilename, logDir, "DatadrivenLoggerTest_*.html"));
            StfAssert.FileExists("StfLogger.CreateSummaryLog", summaryFilename);
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StfKernel"/> class.
        /// </summary>
        public StfKernel()
        {
            StfTextUtils = new StfTextUtils();

            // setup needed kernel directories
            KernelSetupKernelDirectories();

            // lets get a logger and a configuration
            var uniqueKernelLoggerFilename = StfTextUtils.AppendUniquePartToFileName("KernelLogger.html");
            var kernelLoggerFilename       = Path.Combine(StfKernelLogDir, uniqueKernelLoggerFilename);
            var kernelLoggerConfiguration  = new StfLoggerConfiguration
            {
                LogTitle    = "KernelLog",
                LogFileName = kernelLoggerFilename,
                LogLevel    = StfLogLevel.Internal
            };

            KernelLogger = new StfLogger(kernelLoggerConfiguration);

            // get the initial configuration together - at this point in time: Only the kernel configuration
            AssembleStfConfigurationBeforePlugins();

            // Any plugins for us?
            PluginLoader = new StfPluginLoader(KernelLogger, StfConfiguration);
            PluginLoader.RegisterInstance(typeof(StfConfiguration), StfConfiguration);

            if (StfConfiguration.TryGetKeyValue("Configuration.StfKernel.PluginPath", out var pluginPath))
            {
                // TODO: Check for existing config file. If file not found then create default template configuration
                PluginLoader.LoadStfPlugins(pluginPath);
            }

            AssembleStfConfigurationAfterPlugins();

            // now all configurations are loaded, we can set the Environment.
            StfConfiguration.Environment = StfConfiguration.DefaultEnvironment;

            LoadConfigurationForStfTypes();
            DumpStfConfiguration();

            KernelLogger.LogKeyValue("Stf Root", StfRoot, "The Stf Root directory");
        }
Пример #3
0
        /// <summary>
        /// The set up archiver if necessary.
        /// </summary>
        /// <param name="testName">
        /// The test name.
        /// </param>
        private void SetUpArchiver(string testName)
        {
            var stfConfiguration      = Get <StfConfiguration>();
            var archiverConfiguration = new StfArchiverConfiguration();

            try
            {
                stfConfiguration.LoadUserConfiguration(archiverConfiguration);
            }
            catch (Exception exception)
            {
                var msg = $"Something went wrong while loading user configuration for archiver: {exception.Message}";
                StfLogger.LogError(msg);
            }

            archiverConfiguration.ArchiveTopDir      = StfTextUtils.ExpandVariables(archiverConfiguration.ArchiveTopDir);
            archiverConfiguration.ArchiveDestination = StfTextUtils.ExpandVariables(archiverConfiguration.ArchiveDestination);
            archiverConfiguration.TempDirectory      = StfTextUtils.ExpandVariables(archiverConfiguration.TempDirectory);
            StfArchiver = new StfArchiver(archiverConfiguration, testName);
        }