コード例 #1
0
ファイル: TestCycleException.cs プロジェクト: jbtule/PclUnit
        public void Add(TestCycle cycle, Exception exception)
        {
            var testException = exception as TestCycleExceptions;
            if (testException != null)
            {
                Add(testException);
                return;
            }

            //Unwrap Target invocation Exceptions if possible
            if (exception is TargetInvocationException)
            {
                exception = exception.InnerException ?? exception;
            }

            switch (cycle)
            {
                case TestCycle.Setup:
                    Setup.Add(exception);
                    break;
                case TestCycle.Test:
                    Test.Add(exception);
                    break;
                case TestCycle.Teardown:
                    Teardown.Add(exception);
                    break;
            }
        }
コード例 #2
0
        public void Add(TestCycle cycle, Exception exception)
        {
            var testException = exception as TestCycleExceptions;

            if (testException != null)
            {
                Add(testException);
                return;
            }

            //Unwrap Target invocation Exceptions if possible
            if (exception is TargetInvocationException)
            {
                exception = exception.InnerException ?? exception;
            }

            switch (cycle)
            {
            case TestCycle.Setup:
                Setup.Add(exception);
                break;

            case TestCycle.Test:
                Test.Add(exception);
                break;

            case TestCycle.Teardown:
                Teardown.Add(exception);
                break;
            }
        }
コード例 #3
0
        public void TestStepMapVerification()
        {
            var project = new JiraProject {
                Key = "TEST", Name = "Test project"
            };

            using (var transaction = Session.BeginTransaction())
            {
                Session.Save(project);

                JiraIssue issue = new JiraIssue
                {
                    Id      = 1,
                    Project = project
                };

                TestCycle cycle = new TestCycle
                {
                    Id      = 1,
                    Project = project
                };

                TestSchedule schedule = new TestSchedule
                {
                    Id      = 1,
                    Cycle   = cycle,
                    Issue   = issue,
                    Project = project
                };

                TestStep step = new TestStep
                {
                    Id       = 1,
                    Issue    = issue,
                    Schedule = schedule
                };

                Session.Save(issue);
                Session.Save(cycle);
                Session.Save(schedule);
                Session.Save(step);

                new PersistenceSpecification <TestStepResult>(Session)
                .CheckProperty(p => p.Id, 1)
                .CheckProperty(p => p.Comment, "No comment")
                .CheckProperty(p => p.CreatedBy, "Magnus")
                .CheckProperty(p => p.ExecutedBy, "Magnus")
                .CheckProperty(p => p.Status, ZTestExtractor.Data.Entities.Zephyr.TestStatus.Pass.ToString())
                .CheckReference(p => p.Step, step)
                .CheckReference(p => p.Project, project)
                .CheckReference(p => p.Schedule, schedule)
                .VerifyTheMappings();
            }
        }
コード例 #4
0
        public void TestScheduleMapVerification()
        {
            var project = new JiraProject {
                Key = "TEST", Name = "Test project"
            };

            using (var transaction = Session.BeginTransaction())
            {
                Session.Save(project);

                JiraIssue issue = new JiraIssue
                {
                    Id      = 1,
                    Project = project
                };

                TestCycle cycle = new TestCycle
                {
                    Id          = 1,
                    Name        = "Test Cycle",
                    Project     = project,
                    Description = "A test cycle"
                };

                Session.Save(issue);
                Session.Save(cycle);

                new PersistenceSpecification <TestSchedule>(Session)
                .CheckProperty(p => p.Id, 1)
                .CheckProperty(p => p.CreatedBy, "Magnus")
                .CheckProperty(p => p.CreatedDate, DateTime.Today)
                .CheckProperty(p => p.Assignee, "Magnus")
                .CheckProperty(p => p.Comment, "Hello World!")
                .CheckProperty(p => p.ExecutedBy, "Jim")
                .CheckProperty(p => p.Order, 1)
                .CheckProperty(p => p.Status, ZTestExtractor.Data.Entities.Zephyr.TestStatus.Pass)
                .CheckReference(p => p.Project, project)
                .CheckReference(p => p.Issue, issue)
                .CheckReference(p => p.Cycle, cycle)
                .VerifyTheMappings();
            }
        }
コード例 #5
0
        public async void Start(StartProcessedDelegate callback)
        {
            Stopwatch   sw        = new Stopwatch();
            Func <Task> startTask = () =>
            {
                return(Task.Run(() =>
                {
                    idleswflag = false;
                    idlesw.Stop();
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index - 1).ToString(), "TestIdle", TestIdle.ToString());
                    TestCycle = TestSpan + TestIdle;
                    Inifile.INIWriteValue(iniTesterResutPath, "Tester" + (Index - 1).ToString(), "TestCycle", TestCycle.ToString());
                    sw.Start();
                    TestStatus = TestStatus.Testing;
                    TestResult = TestResult.Unknow;
                    while (TestStatus == TestStatus.Testing)
                    {
                        TestSpan = Math.Round(sw.Elapsed.TotalSeconds, 2);
                        System.Threading.Thread.Sleep(100);
                    }
                }));
            };

            await startTask();

            callback(Index);
            if (!IsInSampleMode && !IsInGRRMode)
            {
                UpdateNormal();
            }

            idleswflag = true;
            idlesw.Restart();
        }
コード例 #6
0
        public void GetSchedulesByCycleIdGetsTheCorrectSchedules()
        {
            var project1 = new JiraProject
            {
                Id   = 1,
                Key  = "TEST",
                Name = "Test project"
            };

            var project2 = new JiraProject
            {
                Id   = 2,
                Key  = "FOO",
                Name = "An arbitrary project"
            };

            var cycle1 = new TestCycle
            {
                Id      = 1,
                Name    = "First test cycle",
                Project = project1
            };

            var cycle2 = new TestCycle
            {
                Id      = 2,
                Name    = "Second test cycle",
                Project = project2
            };

            var cycle3 = new TestCycle
            {
                Id      = 3,
                Name    = "Third test cycle",
                Project = project2
            };

            var issue = new JiraIssue
            {
                Id      = 1,
                Project = project1,
                Summary = "A test issue"
            };

            var schedule1 = new TestSchedule
            {
                Id      = 1,
                Cycle   = cycle1,
                Project = project1,
                Issue   = issue
            };

            var schedule2 = new TestSchedule
            {
                Id      = 1,
                Cycle   = cycle2,
                Project = project2,
                Issue   = issue
            };

            IEnumerable <TestSchedule> schedules1 = null;
            IEnumerable <TestSchedule> schedules2 = null;

            using (var transaction = Session.BeginTransaction())
            {
                Session.Save(project1);
                Session.Save(project2);
                Session.Save(cycle1);
                Session.Save(cycle2);
                Session.Save(cycle3);
                Session.Save(issue);
                Session.Save(schedule1);
                Session.Save(schedule2);

                schedules1 = Repository.GetSchedulesByCycleId(cycle1.Id);
                schedules2 = Repository.GetSchedulesByCycleId(cycle2.Id);
            }

            Assert.That(schedules1, Is.Not.Null);
            Assert.That(schedules1.Count(), Is.EqualTo(1));
            Assert.That(schedules1.Single(), Is.EqualTo(schedule1));

            Assert.That(schedules2, Is.Not.Null);
            Assert.That(schedules2.Count(), Is.EqualTo(1));
            Assert.That(schedules2.Single(), Is.EqualTo(schedule2));
        }