Beispiel #1
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        public virtual void Initialize(TestHarnessSettings settings)
        {
            // Look in the settings for the resize override
            string resizeString;

            if (settings.Parameters.TryGetValue(EnablePluginResizeKeyName, out resizeString))
            {
                bool value;
                if (bool.TryParse(resizeString, out value))
                {
                    EnablePluginResize = value;
                }
            }

            string widthString;

            if (settings.Parameters.TryGetValue(TestColumnWidthKeyName, out widthString))
            {
                int value;
                if (int.TryParse(widthString, out value))
                {
                    TestColumnWidth = value;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// A partial method for PrepareDefaultLogManager.
 /// </summary>
 /// <param name="settings">The test harness settings.</param>
 public static void PrepareCustomLogProviders(TestHarnessSettings settings)
 {
     if (HtmlPage.IsEnabled)
     {
         settings.LogProviders.Add(new WebpageHeaderLogProvider(SystemName));
         settings.LogProviders.Add(new UnitTestWebpageLog());
         settings.LogProviders.Add(new TextFailuresLogProvider());
     }
 }
Beispiel #3
0
        /// <summary>
        /// Initialize the harness with a set of test assemblies.
        /// </summary>
        /// <param name="settings">Initial harness settings.</param>
        public override void Initialize(TestHarnessSettings settings)
        {
            // Let the base initialize the log providers
            base.Initialize(settings);

            // Attach to the unhandled exception handler
            InterceptAllExceptions = true;

            LogWriter.TestInfrastructure(Properties.UnitTestMessage.UnitTestHarness_Initialize_UnitTestHarnessInitialize);
            PrepareTestAssemblyTasks();
        }
Beispiel #4
0
        public static TestHarnessSettings TestHarnessSettings(this NameValueCollection settings)
        {
            var harnessSettings = new TestHarnessSettings();

            if (!string.IsNullOrEmpty(settings["MassTransit:TestHarnessTimeout"]))
            {
                harnessSettings.Timeout = Convert.ToInt32(settings["MassTransit:TestHarnessTimeout"]);
            }

            return(harnessSettings);
        }
Beispiel #5
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        public override void Initialize(TestHarnessSettings settings)
        {
            base.Initialize(settings);

            RegisterLoggingHandlers();

            // Initializes the static provider control if it does not yet exist
            WebBrowserTestPage page = WebpageLogProviderBase.TestPage;

            // Creates and appends the header control
            _control = new TestColumnHeader(DisplayName);
            page.TestColumn.Controls.Add(_control);
        }
Beispiel #6
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        public override void Initialize(TestHarnessSettings settings)
        {
            base.Initialize(settings);

            RegisterLogHandlers();

            // Initializes the static provider control if it does not yet exist
            WebBrowserTestPage page = WebpageLogProviderBase.TestPage;

            // Simple div for logging
            _myLog             = new HtmlDiv();
            _myLog.Padding.All = 0;
            page.TestColumn.Controls.Add(_myLog);
        }
Beispiel #7
0
        /// <summary>
        /// Prepares the default log manager.
        /// </summary>
        /// <param name="settings">The test harness settings.</param>
        public static void SetStandardLogProviders(TestHarnessSettings settings)
        {
            // Debug provider
            DebugOutputProvider debugger = new DebugOutputProvider();

            debugger.ShowAllFailures = true;
            settings.LogProviders.Add(debugger);

            // Visual Studio log provider
            try
            {
                TryAddVisualStudioLogProvider(settings);
            }
            finally
            {
            }

            PrepareCustomLogProviders(settings);
        }
Beispiel #8
0
        /// <summary>
        /// Tries to instantiate and initialize a VSTT provider. Requires that
        /// XLinq is available and included in the application package.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        private static void TryAddVisualStudioLogProvider(TestHarnessSettings settings)
        {
            VisualStudioLogProvider trx = new VisualStudioLogProvider();

            settings.LogProviders.Add(trx);
        }
Beispiel #9
0
 /// <summary>
 /// A partial method for setting the TestService.
 /// </summary>
 /// <param name="settings">The test harness settings.</param>
 private static void SetTestService(TestHarnessSettings settings)
 {
 }
Beispiel #10
0
 /// <summary>
 /// A partial method for PrepareDefaultLogManager.
 /// </summary>
 /// <param name="settings">The test harness settings.</param>
 private static void PrepareDefaultLogManagerOptional(TestHarnessSettings settings)
 {
 }
Beispiel #11
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings.</param>
        public void Initialize(TestHarnessSettings settings)
        {
            UnitTestHarness uth = settings.TestHarness as UnitTestHarness;

            if (uth != null)
            {
                // Attach to store the log file
                uth.Publishing += (o, e) => WriteLogFile(uth);

                // Look for a unique test run ID
                if (uth.TestService != null)
                {
                    string runId = uth.TestService.UniqueTestRunIdentifier;
                    if (!string.IsNullOrEmpty(runId))
                    {
                        TestRunId = runId;
                    }
                }
            }

            string filename;

            if (settings.Parameters.TryGetValue("log", out filename))
            {
                TestResultsFileName = filename;
            }

            // Read pre-defined optional settings and environment variables
            List <string> prefix = new List <string>();
            string        initialPrefix;

            if (settings.Parameters.TryGetValue("testRunNamePrefix", out initialPrefix))
            {
                prefix.Add(initialPrefix);
            }

            string userName;

            if (settings.Parameters.TryGetValue("userName", out userName))
            {
                prefix.Add(userName);
                UserName = userName;
            }

            string computerName;

            if (settings.Parameters.TryGetValue("computerName", out computerName))
            {
                prefix.Add(computerName);
                ComputerName = computerName;
            }

            for (int i = 0; i < prefix.Count; ++i)
            {
                if (TestRunNamePrefix.Length > 0)
                {
                    TestRunNamePrefix += "_";
                }
                TestRunNamePrefix += prefix[i];
            }
        }
Beispiel #12
0
        /// <summary>
        /// Initializes the test harness.
        /// </summary>
        /// <param name="settings">The test harness settings object.</param>
        public override void Initialize(TestHarnessSettings settings)
        {
            base.Initialize(settings);

            InitializeComponent();
        }
Beispiel #13
0
 /// <summary>
 /// A partial method for setting the TestService.
 /// </summary>
 /// <param name="settings">The test harness settings.</param>
 public static void SetTestService(TestHarnessSettings settings)
 {
     settings.TestService = new SilverlightTestService();
 }