Ejemplo n.º 1
0
        public void InstantiateLogger()
        {
            Gallio            task       = new Gallio();
            TaskLoggingHelper taskLogger = new TaskLoggingHelper(task);

            new TaskLogger(taskLogger);
        }
        public override void ApplyPendingSettingsChanges(Gallio.Runtime.Security.IElevationContext elevationContext, 
            Gallio.Runtime.ProgressMonitoring.IProgressMonitor progressMonitor)
        {
            base.ApplyPendingSettingsChanges(elevationContext, progressMonitor);

            optionsController.TestRunnerExtensions.Clear();
            foreach (var testRunnerExtension in testRunnerExtensions)
                optionsController.TestRunnerExtensions.Add(testRunnerExtension);

            optionsController.Save();
        }
Ejemplo n.º 3
0
        internal static void RunWithTemporaryPluginFile(Gallio.Common.Action<string, string> action, string pluginFileContents)
        {
            var pluginDir = SpecialPathPolicy.For<PluginLoaderTest>().GetTempDirectory().FullName;
            if (Directory.Exists(pluginDir))
                Directory.Delete(pluginDir, true);
            var pluginFile = Path.Combine(pluginDir, "Sample.plugin");
            try
            {
                Directory.CreateDirectory(pluginDir);
                System.IO.File.WriteAllText(pluginFile, pluginFileContents);

                action(pluginDir, pluginFile);
            }
            finally
            {
                if (Directory.Exists(pluginDir))
                    Directory.Delete(pluginDir, true);
            }
        }
Ejemplo n.º 4
0
        private void DoRetry(bool expectedSucceeded, Gallio.Common.Action action)
        {
            AssertionFailure[] failures = Capture(action);

            if (expectedSucceeded)
            {
                Assert.IsEmpty(failures);
            }
            else
            {
                Assert.Count(1, failures);
                Assert.StartsWith(failures[0].Description, "The 'Retry.Until' operation has failed");
            }
        }
  //      private void recordResult(TestStepRun data, TestLinkFixtureAttribute tlfa, int testPlanId, int TCaseId)
        private void recordResult(Gallio.Runner.Reports.Schema.TestStepRun data,  int TCaseId)
        {
            //Console.Write("2");
            TestCaseResultStatus status = TestCaseResultStatus.Blocked;//= (data.Result.Outcome.Status == TestStatus.Passed)
                //? TestCaseResultStatus.Pass : TestCaseResultStatus.Fail;

            switch (data.Result.Outcome.Status)
            {
                case TestStatus.Passed: status = TestCaseResultStatus.Pass; break;
                case TestStatus.Failed: status = TestCaseResultStatus.Fail; break;
                case TestStatus.Skipped: status = TestCaseResultStatus.Blocked; break;
                case TestStatus.Inconclusive: status = TestCaseResultStatus.Blocked; break;
            }                 

            string notes = data.TestLog.ToString();

            //Debug.WriteLine(
            //    string.Format("ReportTCResult(TCName=\"{0}\", TestPlan=\"{1}\", Status=\"{2}\", Notes=\"{3}\"",
            //    data.Step.Name,
            //    tlfa.TestPlan,
            //    (data.Result.Outcome.Status == TestStatus.Passed) ? "p" : "f",
            //   notes));

            //Console.Write("3");
            GeneralResult reportResult = adaptor.RecordTheResult(TCaseId, status, notes);//proxy.ReportTCResult(TCaseId, testPlanId, status, notes);
            //Console.Write("4");
            if (reportResult.status == true)
                Console.WriteLine("Recorded test run result for {0} as {1}",
                    data.Step.Name, data.Result.Outcome);
            else
                Console.Error.WriteLine(string.Format("recorded test result. status={0}, message ='{0}'",
                    reportResult.status, reportResult.message));
        }
        /// <summary>
        /// export the result of the run to TestLink. As a sideeffect, this may create a test case
        /// </summary>
        /// <param name="data"></param>
        public void ReportResult(Gallio.Runner.Reports.Schema.TestStepRun data)
        {
            
            try
            {
                TestLinkFixtureAttribute tlfa = getFixture(data.Step.FullName);
                if (tlfa == null)
                {
                    Debug.WriteLine(string.Format("Failed to find testlinkfixture of name {0}", data.Step.FullName));
                    Console.Error.WriteLine("Failed to find testlinkfixture of name {0}", data.Step.FullName);
                    adaptor.ConnectionData = null;
                    return;
                }
                adaptor.ConnectionData = tlfa;
                //Debug.WriteLine(string.Format("new Testlink({0}, {1}", tlfa.DevKey, tlfa.Url));


                string TestName = data.Step.Name;
                // Console.WriteLine(TestName);
                if (adaptor.ConnectionValid)
                {
                    int tcid = adaptor.GetTestCaseId(TestName);
                    if (tcid > 0)
                    {
                        //Console.Write("1");
                        recordResult(data, tcid);
                        
                    }
                    else Console.WriteLine("Could not find test case named '{0}'", TestName);
                }
                else
                    Console.WriteLine(" -- Failed to export {0} --", TestName);
            }
            catch (TestLinkException tlex)
            {
                Debug.WriteLine(tlex.Message);
                Console.WriteLine(tlex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred in TestLinkAddOn");
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
        }
Ejemplo n.º 7
0
 protected override void PopulateDataSource(IPatternScope scope, DataSource dataSource, Gallio.Common.Reflection.ICodeElementInfo codeElement)
 {
     dataSource.AddDataSet(new SharedDataSet());
     base.PopulateDataSource(scope, dataSource, codeElement);
 }