Exemplo n.º 1
0
        /// <summary>
        /// Builds the scenario.
        /// </summary>
        /// <param name="scenario">The scenario.</param>
        /// <param name="testCaseComponent">The test case component.</param>
        private void BuildScenario(ScenarioDTO scenario, TestCaseComponent testCaseComponent)
        {
            if (!string.IsNullOrEmpty(testCaseComponent.TestCaseSetter))
            {
                scenario.Setters.Add(testCaseComponent.TestCaseSetter);
            }
            if (!string.IsNullOrEmpty(testCaseComponent.TestCaseDBValidator))
            {
                scenario.DBValidators.Add(testCaseComponent.TestCaseDBValidator);
            }
            if (!string.IsNullOrEmpty(testCaseComponent.TestCaseEditModeValidator))
            {
                scenario.EditModeValidators.Add(testCaseComponent.TestCaseEditModeValidator);
            }
            if (!string.IsNullOrEmpty(testCaseComponent.TestCaseViewModeValidator))
            {
                scenario.ViewModeValidators.Add(testCaseComponent.TestCaseViewModeValidator);
            }

            if (!string.IsNullOrEmpty(testCaseComponent.OnScreenValidator))
            {
                scenario.OnScreenValidators.Add(testCaseComponent.OnScreenValidator);
            }

            if (!string.IsNullOrEmpty(testCaseComponent.Description))
            {
                scenario.ScenarioDescription.Add(testCaseComponent.Description);
            }
        }
Exemplo n.º 2
0
        private void InitializeComponent()
        {
            this.components                 = new System.ComponentModel.Container();
            this.performanceCounter1        = new System.Diagnostics.PerformanceCounter();
            this.performanceCounterChecker1 = new MbUnit.Framework.ComponentModel.PerformanceCounterChecker(this.components);
            this.testCaseComponent1         = new MbUnit.Framework.ComponentModel.TestCaseComponent(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.performanceCounter1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.performanceCounterChecker1)).BeginInit();
//
// performanceCounter1
//
            this.performanceCounter1.CategoryName = ".NET CLR Data";
            this.performanceCounter1.CounterName  = "SqlClient: Current # connection pools";
//
// performanceCounterChecker1
//
            this.performanceCounterChecker1.MaxValue           = 10F;
            this.performanceCounterChecker1.MinValue           = 0F;
            this.performanceCounterChecker1.PerformanceCounter = this.performanceCounter1;
//
// testCaseComponent1
//
            this.testCaseComponent1.Test += new System.EventHandler(this.testCaseComponent1_Test_3);
            ((System.ComponentModel.ISupportInitialize)(this.performanceCounter1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.performanceCounterChecker1)).EndInit();
        }
Exemplo n.º 3
0
 /// <summary>
 /// Builds the scenario.
 /// </summary>
 /// <param name="scenario">The scenario.</param>
 /// <param name="testCaseComponent">The test case component.</param>
 private void BuildScenario(ScenarioDTO scenario, TestCaseComponent testCaseComponent)
 {
     scenario.Setters.Add(testCaseComponent.TestCaseSetter);
     scenario.DBValidators.Add(testCaseComponent.TestCaseDBValidator);
     scenario.EditModeValidators.Add(testCaseComponent.TestCaseEditModeValidator);
     scenario.ViewModeValidators.Add(testCaseComponent.TestCaseViewModeValidator);
     scenario.IsSaveWillSucceed = testCaseComponent.WillSaveSucceed;
 }
Exemplo n.º 4
0
        private List <TestCaseComponent> GenerateNegativeTestCases(TestCaseComponentGroup groupInFocus, TestCaseComponent negativeTestCase)
        {
            List <TestCaseComponent> testCases = new List <TestCaseComponent>();

            foreach (TestCaseComponentGroup group in TestCaseGroups)
            {
                if (group.ControlName == groupInFocus.ControlName)
                {
                    testCases.Add(negativeTestCase);
                }
                else
                {
                    List <TestCaseComponent> positiveTestCases = FilterTestCases(group.TestCaseComponents, TestCaseTypeHelper.PositiveTestCaseTypes);
                    var firstTestCase = GetLRUPositiveTestCase_IncrementCounters(group, positiveTestCases);
                    testCases.Add(firstTestCase);
                }
            }

            return(testCases);
        }
Exemplo n.º 5
0
        private List <TestCaseComponentGroup> BuildData_Simple(ref List <ScenarioDTO> expected_scenarios)
        {
            List <TestCaseComponentGroup> groups       = new List <TestCaseComponentGroup>();
            TestCaseComponentGroup        firstControl = new TestCaseComponentGroup();

            firstControl.ControlName = "FirstControl";

            List <TestCaseComponent> firstControl_Components = new List <TestCaseComponent>();
            TestCaseComponent        firstControl_Component1 = new TestCaseComponent();

            firstControl_Component1.Name = "firstControl_Component1";
            firstControl_Component1.Type = TestCaseType.POSITIVE;
            firstControl_Components.Add(firstControl_Component1);

            TestCaseComponent firstControl_Component2 = new TestCaseComponent();

            firstControl_Component2.Name = "firstControl_Component2";
            firstControl_Component2.Type = TestCaseType.POSITIVE;
            firstControl_Components.Add(firstControl_Component2);

            TestCaseComponent firstControl_Component3 = new TestCaseComponent();

            firstControl_Component3.Name = "firstControl_Component3";
            firstControl_Component3.Type = TestCaseType.NEGATIVE;
            firstControl_Components.Add(firstControl_Component3);

            TestCaseComponent firstControl_Component4 = new TestCaseComponent();

            firstControl_Component4.Name = "firstControl_Component4";
            firstControl_Component4.Type = TestCaseType.DEFAULT;
            firstControl_Components.Add(firstControl_Component4);

            firstControl.TestCaseComponents = firstControl_Components;

            groups.Add(firstControl);

            TestCaseComponentGroup secondControl = new TestCaseComponentGroup();

            secondControl.ControlName = "secondControl";

            List <TestCaseComponent> secondControl_Components = new List <TestCaseComponent>();
            TestCaseComponent        secondControl_Component1 = new TestCaseComponent();

            secondControl_Component1.Name = "secondControl_Component1";
            secondControl_Component1.Type = TestCaseType.POSITIVE;
            secondControl_Components.Add(secondControl_Component1);

            TestCaseComponent secondControl_Component2 = new TestCaseComponent();

            secondControl_Component2.Name = "secondControl_Component2";
            secondControl_Component2.Type = TestCaseType.DEFAULT;
            secondControl_Components.Add(secondControl_Component2);

            TestCaseComponent secondControl_Component3 = new TestCaseComponent();

            secondControl_Component3.Name = "secondControl_Component3";
            secondControl_Component3.Type = TestCaseType.NEGATIVE;
            secondControl_Components.Add(secondControl_Component3);

            secondControl.TestCaseComponents = secondControl_Components;

            groups.Add(secondControl);

            ScenarioDTO scenario1 = new ScenarioDTO();

            scenario1.Name = "POSITIVE_1";
            BuildScenario(scenario1, firstControl_Component1);
            BuildScenario(scenario1, secondControl_Component1);
            expected_scenarios.Add(scenario1);

            ScenarioDTO scenario2 = new ScenarioDTO();

            scenario2.Name = "POSITIVE_2";
            BuildScenario(scenario2, firstControl_Component2);
            BuildScenario(scenario2, secondControl_Component2);
            expected_scenarios.Add(scenario2);

            ScenarioDTO scenario3 = new ScenarioDTO();

            scenario3.Name = "POSITIVE_3";
            BuildScenario(scenario3, firstControl_Component4);
            BuildScenario(scenario3, secondControl_Component1);
            expected_scenarios.Add(scenario3);

            ScenarioDTO scenario4 = new ScenarioDTO();

            scenario4.Name = "NEGATIVE_1";
            BuildScenario(scenario4, firstControl_Component3);
            BuildScenario(scenario4, secondControl_Component2);
            expected_scenarios.Add(scenario4);

            ScenarioDTO scenario5 = new ScenarioDTO();

            scenario5.Name = "NEGATIVE_2";
            BuildScenario(scenario5, firstControl_Component1);
            BuildScenario(scenario5, secondControl_Component3);
            expected_scenarios.Add(scenario5);

            return(groups);
        }
Exemplo n.º 6
0
        private List <TestCaseComponentGroup> BuildData_FourControls(ref List <ScenarioDTO> expected_scenarios)
        {
            List <TestCaseComponentGroup> groups = new List <TestCaseComponentGroup>();
            TestCaseComponentGroup        C1     = new TestCaseComponentGroup();

            C1.ControlName = "C1";

            TestCaseComponent C1_P1 = new TestCaseComponent();

            C1_P1.Name = "C1_P1";
            C1_P1.Type = TestCaseType.POSITIVE;
            C1.TestCaseComponents.Add(C1_P1);

            TestCaseComponent C1_P2 = new TestCaseComponent();

            C1_P2.Name = "C1_P2";
            C1_P2.Type = TestCaseType.POSITIVE;
            C1.TestCaseComponents.Add(C1_P2);

            TestCaseComponent C1_D1 = new TestCaseComponent();

            C1_D1.Name = "C1_D1";
            C1_D1.Type = TestCaseType.DEFAULT;
            C1.TestCaseComponents.Add(C1_D1);

            TestCaseComponent C1_N1 = new TestCaseComponent();

            C1_N1.Name = "C1_N1";
            C1_N1.Type = TestCaseType.NEGATIVE;
            C1.TestCaseComponents.Add(C1_N1);

            TestCaseComponent C1_N2 = new TestCaseComponent();

            C1_N2.Name = "C1_N2";
            C1_N2.Type = TestCaseType.NEGATIVE;
            C1.TestCaseComponents.Add(C1_N2);

            groups.Add(C1);

            TestCaseComponentGroup C2 = new TestCaseComponentGroup();

            C2.ControlName = "C2";

            TestCaseComponent C2_P1 = new TestCaseComponent();

            C2_P1.Name = "C2_P1";
            C2_P1.Type = TestCaseType.POSITIVE;
            C2.TestCaseComponents.Add(C2_P1);

            TestCaseComponent C2_N1 = new TestCaseComponent();

            C2_N1.Name = "C2_N1";
            C2_N1.Type = TestCaseType.NEGATIVE;
            C2.TestCaseComponents.Add(C2_N1);

            groups.Add(C2);

            TestCaseComponentGroup C3 = new TestCaseComponentGroup();

            C3.ControlName = "C3";

            TestCaseComponent C3_P1 = new TestCaseComponent();

            C3_P1.Name = "C3_P1";
            C3_P1.Type = TestCaseType.POSITIVE;
            C3.TestCaseComponents.Add(C3_P1);

            TestCaseComponent C3_P2 = new TestCaseComponent();

            C3_P2.Name = "C3_P2";
            C3_P2.Type = TestCaseType.POSITIVE;
            C3.TestCaseComponents.Add(C3_P2);

            TestCaseComponent C3_D1 = new TestCaseComponent();

            C3_D1.Name = "C3_D1";
            C3_D1.Type = TestCaseType.DEFAULT;
            C3.TestCaseComponents.Add(C3_D1);

            TestCaseComponent C3_D2 = new TestCaseComponent();

            C3_D2.Name = "C3_D2";
            C3_D2.Type = TestCaseType.DEFAULT;
            C3.TestCaseComponents.Add(C3_D2);

            TestCaseComponent C3_N1 = new TestCaseComponent();

            C3_N1.Name = "C3_N1";
            C3_N1.Type = TestCaseType.NEGATIVE;
            C3.TestCaseComponents.Add(C3_N1);

            TestCaseComponent C3_N2 = new TestCaseComponent();

            C3_N2.Name = "C3_N2";
            C3_N2.Type = TestCaseType.NEGATIVE;
            C3.TestCaseComponents.Add(C3_N2);

            groups.Add(C3);

            TestCaseComponentGroup C4 = new TestCaseComponentGroup();

            C4.ControlName = "C4";

            TestCaseComponent C4_P1 = new TestCaseComponent();

            C4_P1.Name = "C4_P1";
            C4_P1.Type = TestCaseType.POSITIVE;
            C4.TestCaseComponents.Add(C4_P1);

            TestCaseComponent C4_N1 = new TestCaseComponent();

            C4_N1.Name = "C3_N1";
            C4_N1.Type = TestCaseType.NEGATIVE;
            C4.TestCaseComponents.Add(C4_N1);

            TestCaseComponent C4_N2 = new TestCaseComponent();

            C4_N2.Name = "C4_N2";
            C4_N2.Type = TestCaseType.NEGATIVE;
            C4.TestCaseComponents.Add(C4_N2);

            TestCaseComponent C4_N3 = new TestCaseComponent();

            C4_N3.Name = "C4_N3";
            C4_N3.Type = TestCaseType.NEGATIVE;
            C4.TestCaseComponents.Add(C4_N3);

            TestCaseComponent C4_P2 = new TestCaseComponent();

            C4_P2.Name = "C4_P2";
            C4_P2.Type = TestCaseType.POSITIVE;
            C4.TestCaseComponents.Add(C4_P2);

            groups.Add(C4);

            ScenarioDTO scenario1 = new ScenarioDTO();

            scenario1.Name = "POSITIVE_1";
            BuildScenario(scenario1, C1_P1);
            BuildScenario(scenario1, C2_P1);
            BuildScenario(scenario1, C3_P1);
            BuildScenario(scenario1, C4_P1);
            expected_scenarios.Add(scenario1);

            ScenarioDTO scenario2 = new ScenarioDTO();

            scenario2.Name = "POSITIVE_2";
            BuildScenario(scenario2, C1_P2);
            BuildScenario(scenario2, C2_P1);
            BuildScenario(scenario2, C3_P2);
            BuildScenario(scenario2, C4_P2);
            expected_scenarios.Add(scenario2);

            ScenarioDTO scenario3 = new ScenarioDTO();

            scenario3.Name = "POSITIVE_3";
            BuildScenario(scenario3, C1_D1);
            BuildScenario(scenario3, C2_P1);
            BuildScenario(scenario3, C3_D1);
            BuildScenario(scenario3, C4_P1);
            expected_scenarios.Add(scenario3);

            ScenarioDTO scenario4 = new ScenarioDTO();

            scenario4.Name = "POSITIVE_4";
            BuildScenario(scenario4, C1_P1);
            BuildScenario(scenario4, C2_P1);
            BuildScenario(scenario4, C3_D2);
            BuildScenario(scenario4, C4_P2);
            expected_scenarios.Add(scenario4);

            ScenarioDTO scenario5 = new ScenarioDTO();

            scenario5.Name = "NEGATIVE_1";
            BuildScenario(scenario5, C1_N1);
            BuildScenario(scenario5, C2_P1);
            BuildScenario(scenario5, C3_P1);
            BuildScenario(scenario5, C4_P1);
            expected_scenarios.Add(scenario5);

            ScenarioDTO scenario6 = new ScenarioDTO();

            scenario6.Name = "NEGATIVE_2";
            BuildScenario(scenario6, C1_N2);
            BuildScenario(scenario6, C2_P1);
            BuildScenario(scenario6, C3_P2);
            BuildScenario(scenario6, C4_P2);
            expected_scenarios.Add(scenario6);

            ScenarioDTO scenario7 = new ScenarioDTO();

            scenario7.Name = "NEGATIVE_3";
            BuildScenario(scenario7, C1_P2);
            BuildScenario(scenario7, C2_N1);
            BuildScenario(scenario7, C3_D1);
            BuildScenario(scenario7, C4_P1);
            expected_scenarios.Add(scenario7);

            ScenarioDTO scenario8 = new ScenarioDTO();

            scenario8.Name = "NEGATIVE_4";
            BuildScenario(scenario8, C1_D1);
            BuildScenario(scenario8, C2_P1);
            BuildScenario(scenario8, C3_N1);
            BuildScenario(scenario8, C4_P2);
            expected_scenarios.Add(scenario8);

            ScenarioDTO scenario9 = new ScenarioDTO();

            scenario9.Name = "NEGATIVE_5";
            BuildScenario(scenario9, C1_P1);
            BuildScenario(scenario9, C2_P1);
            BuildScenario(scenario9, C3_N2);
            BuildScenario(scenario9, C4_P1);
            expected_scenarios.Add(scenario9);

            ScenarioDTO scenario10 = new ScenarioDTO();

            scenario10.Name = "NEGATIVE_6";
            BuildScenario(scenario10, C1_P2);
            BuildScenario(scenario10, C2_P1);
            BuildScenario(scenario10, C3_D2);
            BuildScenario(scenario10, C4_N1);
            expected_scenarios.Add(scenario10);

            ScenarioDTO scenario11 = new ScenarioDTO();

            scenario11.Name = "NEGATIVE_7";
            BuildScenario(scenario11, C1_D1);
            BuildScenario(scenario11, C2_P1);
            BuildScenario(scenario11, C3_P1);
            BuildScenario(scenario11, C4_N2);
            expected_scenarios.Add(scenario11);

            ScenarioDTO scenario12 = new ScenarioDTO();

            scenario12.Name = "NEGATIVE_8";
            BuildScenario(scenario12, C1_P1);
            BuildScenario(scenario12, C2_P1);
            BuildScenario(scenario12, C3_P2);
            BuildScenario(scenario12, C4_N3);
            expected_scenarios.Add(scenario12);

            return(groups);
        }