Description of TestCase.
Inheritance: ITestCase
Beispiel #1
0
        internal static bool AddTestCase(
            string testCaseName,
            string testCaseId,
            string testCaseDescription,
            string testSuiteName,
            string testSuiteId,
            string testScenarioName,
            string testScenarioId,
            Guid testPlatformId,
            // 20141211
            // ScriptBlock[] testCode)
            ICodeBlock[] testCode)
        {
            bool result = false;
            
            var testSuite =
                TestData.GetTestSuite(
                    testSuiteName,
                    testSuiteId,
                    testPlatformId) ?? TestData.CurrentTestSuite;

            /*
            if (null == testSuite) { // ?? mistaken behavior ??
                
                testSuite = TestData.CurrentTestSuite;
            }
            */
            
            var testScenario =
                TestData.GetTestScenario(
                    testSuite,
                    testScenarioName,
                    testScenarioId,
                    testSuiteName,
                    testSuiteId,
                    testPlatformId);
            
            if (null == testScenario) { // ?? mistaken behavior ??
                
                testScenario = TestData.CurrentTestScenario;
            }
            
            var testCase =
                new TestCase(
                    testCaseName,
                    testCaseId);
            
            testCase.Description = testCaseDescription;
            testCase.TestCode = testCode;
            TestData.CurrentTestCase = testCase;
            
            try {
                
                testScenario.TestCases.Add(testCase);
                result = true;
            }
            catch (Exception eFailedToAdd) {
                throw eFailedToAdd;
                //result = false;
            }
            
            return result;
        }