コード例 #1
0
        /// <summary>
        /// Processes all testcase events.
        /// <see cref="AllureCSharpCommons.Events.TestCaseStartedEvent"/>
        /// <see cref="AllureCSharpCommons.Events.TestCasePendingEvent"/>
        /// <see cref="AllureCSharpCommons.Events.TestCaseCanceledEvent"/>
        /// <see cref="AllureCSharpCommons.Events.TestCaseFinishedEvent"/>
        /// </summary>
        /// <param name="evt">event to process</param>
        public void Fire(ITestCaseEvent evt)
        {
            if (typeof(TestCaseStartedEvent).IsAssignableFrom(evt.GetType()))
            {
                StepStorage.Get();

                var testcaseresult = TestCaseStorage.Get();
                evt.Process(testcaseresult);

                lock (TestSuiteAddChildLock)
                {
                    TestSuiteStorage.Put(evt.SuiteUid);
                    TestSuiteStorage.Get(evt.SuiteUid).testcases =
                        ArraysUtils.Add(TestSuiteStorage.Get(evt.SuiteUid).testcases, testcaseresult);
                }
            }
            else if (typeof(TestCaseFinishedEvent).IsAssignableFrom(evt.GetType()))
            {
                var testcaseresult = TestCaseStorage.Get();
                evt.Process(testcaseresult);

                var root = StepStorage.PollLast();

                testcaseresult.steps       = ArraysUtils.AddAll(testcaseresult.steps, root.steps);
                testcaseresult.attachments = ArraysUtils.AddAll(testcaseresult.attachments, root.attachments);
                StepStorage.Remove();
                TestCaseStorage.Remove();
            }
            else
            {
                var testcaseresult = TestCaseStorage.Get();
                evt.Process(testcaseresult);
            }
        }
コード例 #2
0
        public void TestCaseStorageTest()
        {
            var storage = new TestCaseStorage();
            var testcaseresult1 = new testcaseresult();
            var testcaseresult2 = new testcaseresult();
            var testcaseresult3 = new testcaseresult();

            storage.Put(testcaseresult1);
            Assert.AreEqual(testcaseresult1, storage.Get());

            new Thread(() =>
            {
                storage.Put(testcaseresult2);
                Thread.Sleep(100);
                Assert.AreEqual(testcaseresult2, storage.Get());
            }).Start();

            new Thread(() =>
            {
                storage.Put(testcaseresult3);
                Assert.AreEqual(testcaseresult3, storage.Get());
            }).Start();
        }
コード例 #3
0
        public void TestCaseStorageTest()
        {
            var storage         = new TestCaseStorage();
            var testcaseresult1 = new testcaseresult();
            var testcaseresult2 = new testcaseresult();
            var testcaseresult3 = new testcaseresult();

            storage.Put(testcaseresult1);
            Assert.AreEqual(testcaseresult1, storage.Get());

            new Thread(() =>
            {
                storage.Put(testcaseresult2);
                Thread.Sleep(100);
                Assert.AreEqual(testcaseresult2, storage.Get());
            }).Start();

            new Thread(() =>
            {
                storage.Put(testcaseresult3);
                Assert.AreEqual(testcaseresult3, storage.Get());
            }).Start();
        }