예제 #1
0
        private static void ComputeResult(TestSuiteModel testSuite)
        {
            var results = testSuite.TestCases.Select(x => x.Result).ToList();

            results.AddRange(testSuite.TestSuites.Select(x => x.Result));

            var failed       = "Failed";
            var inconclusive = "Inconclusive";
            var passed       = "Passed";
            var anyMismatch  = results.Where(x => !string.IsNullOrWhiteSpace(x)).Where(x => x != failed)
                               .Where(x => x != inconclusive).Any(x => x != passed);

            if (anyMismatch)
            {
                throw new Exception("Wrong results");
            }
            if (results.Any(string.IsNullOrWhiteSpace))
            {
                testSuite.Result = null;
            }
            else if (results.Any(x => x == failed))
            {
                testSuite.Result = failed;
            }
            else if (results.Any(x => x == inconclusive))
            {
                testSuite.Result = inconclusive;
            }
            else
            {
                testSuite.Result = passed;
            }
        }
예제 #2
0
        /// <summary>
        /// The destroy.
        /// </summary>
        /// <summary>
        /// The initialize.
        /// </summary>
        /// <param name="testConfig">
        /// The test configuration.
        /// </param>
        public void LoadConfigurator(TestConfiguration testConfig)
        {
            this.TestConfiguration = null;
            this.TestConfiguration = testConfig;

            this.TestSuiteModel = new TestSuiteModel();

            this.LoadTestSuiteModel(this.TestSuiteModel, this.TestConfiguration);
        }
예제 #3
0
        private void ComputeDerivedValueForTestSuite(TestSuiteModel testSuite)
        {
            foreach (var childTestSuite in testSuite.TestSuites)
            {
                ComputeDerivedValueForTestSuite(childTestSuite);
            }

            ComputeStartingTime(testSuite);
            ComputeFinishingTime(testSuite);
            ComputeResult(testSuite);
        }
예제 #4
0
        private void ComputeStartingTime(TestSuiteModel testSuite)
        {
            var startingTimes = testSuite.TestCases.Select(x => x.StartingTime).ToList();

            startingTimes.AddRange(testSuite.TestSuites.Select(x => x.StartingTime));
            if (startingTimes.Any(x => !x.HasValue))
            {
                testSuite.StartingTime = null;
            }
            else
            {
                testSuite.StartingTime = startingTimes.Min();
            }
        }
예제 #5
0
        private void ComputeFinishingTime(TestSuiteModel testSuite)
        {
            var finishingTimes = testSuite.TestCases.Select(x => x.FinishingTime).ToList();

            finishingTimes.AddRange(testSuite.TestSuites.Select(x => x.FinishingTime));
            if (finishingTimes.Any(x => !x.HasValue))
            {
                testSuite.FinishingTime = null;
            }
            else
            {
                testSuite.FinishingTime = finishingTimes.Max();
            }
        }
예제 #6
0
        /// <summary>
        /// The load test suite model.
        /// </summary>
        /// <param name="testSuiteModel">
        /// The test suite model.
        /// </param>
        /// <param name="testConfig">
        /// The test config.
        /// </param>
        private void LoadTestSuiteModel(TestSuiteModel testSuiteModel, TestConfiguration testConfig)
        {
            Log.Enter(this, MethodBase.GetCurrentMethod().Name);

            testSuiteModel.TestSuiteList.Clear();

            foreach (var testObject in testConfig.AvailableTestObjects)
            {
                var childFeatur = this.AddNewTestSuiteItem(null, testObject, testObject.IsActive);

                this.TestSuiteModel.TestSuiteList.Add(childFeatur);
            }

            // Feature List headers
            testSuiteModel.ColumnHeader1 = "Method";
            testSuiteModel.ColumnHeader2 = "Parameter";
            testSuiteModel.ColumnHeader3 = "Description";

            this.RaisePropertyChanged("FeatureModel");
        }
예제 #7
0
 /// <summary>
 /// The destroy configurator.
 /// </summary>
 public void UnloadConfigurator()
 {
     this.TestConfiguration = null;
     this.TestSuiteModel    = null;
 }