예제 #1
0
        public static async Task RunNoCatch(string testName, Func <ApplicationManager, Task> action)
        {
            TestTracer.Trace("Running test - {0}", testName);

            var appManager = await SitePool.CreateApplicationAsync();

            TestTracer.Trace("Using site - {0}", appManager.SiteUrl);

            var  dumpPath = Path.Combine(PathHelper.TestResultsPath, testName, testName + ".zip");
            bool succcess = true;

            try
            {
                using (StartLogStream(appManager))
                {
                    await action(appManager);
                }

                KuduUtils.DownloadDump(appManager.ServiceUrl, dumpPath);
            }
            catch (Exception ex)
            {
                KuduUtils.DownloadDump(appManager.ServiceUrl, dumpPath);

                TestTracer.Trace("Run failed with exception\n{0}", ex);

                succcess = false;

                _testFailureOccured = true;

                throw;
            }
            finally
            {
                SafeTraceDeploymentLogs(appManager);

                SitePool.ReportTestCompletion(appManager, succcess);
            }
        }
예제 #2
0
                public TestHarnessCommand(TestHarnessClassCommandAttribute attribute, ITestCommand inner, IMethodInfo testMethod)
                    : base(inner)
                {
                    _testMethod = testMethod;

                    // prefer imperative over config settings
                    if (attribute.Runs != DefaultRuns || !Int32.TryParse(KuduUtils.GetTestSetting(RunsSettingKey), out _runs))
                    {
                        _runs = attribute.Runs;
                    }
                    _runs = Math.Max(DefaultRuns, _runs);

                    if (attribute.Retries != DefaultRetries || !Int32.TryParse(KuduUtils.GetTestSetting(RetriesSettingKey), out _retries))
                    {
                        _retries = attribute.Retries;
                    }
                    _retries = Math.Max(DefaultRetries, _retries);

                    if (attribute.SuppressError != DefaultSuppressError || !Boolean.TryParse(KuduUtils.GetTestSetting(SuppressErrorSettingKey), out _suppressError))
                    {
                        _suppressError = attribute.SuppressError;
                    }
                }