コード例 #1
0
        /// <summary>
        /// Generates the specified arguments.
        /// </summary>
        /// <param name="args">The <see cref="T:Aurigo.Atom.Common.EventArgs.TestCaseComponentGeneratorEventArgs" /> instance containing the event data.</param>
        /// <returns></returns>
        public List <TestCaseComponent> Generate(TestCaseComponentGeneratorOptions args)
        {
            var testCaseComponents = new List <TestCaseComponent>();
            var result             = GenerateDefaultValueTestCase(args.Control);

            if (result != null)
            {
                testCaseComponents.Add(result);
            }

            return(testCaseComponents);
        }
コード例 #2
0
        /// <summary>
        /// Generates the specified arguments.
        /// </summary>
        /// <param name="args">The <see cref="T:Aurigo.Atom.Common.EventArgs.TestCaseComponentGeneratorEventArgs" /> instance containing the event data.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public List <TestCaseComponent> Generate(TestCaseComponentGeneratorOptions args)
        {
            var testCaseComponents = new List <TestCaseComponent>();

            if (!string.IsNullOrEmpty(args.Control.MinValue))
            {
                if (args.TestModuleConfig.IncludeNegativeTestCase)
                {
                    testCaseComponents.Add(GenerateGreaterThanMinValueTestCase(args.Control));
                }
                testCaseComponents.Add(GenerateEqualToMinValueTestCase(args.Control));
                testCaseComponents.Add(GenerateLessThanMinValueTestCase(args.Control));
            }

            return(testCaseComponents);
        }
コード例 #3
0
        /// <summary>
        /// Generates the specified arguments.
        /// </summary>
        /// <param name="args">The <see cref="T:Aurigo.Atom.Common.EventArgs.TestCaseGeneratorEventArgs" /> instance containing the event data.</param>
        /// <returns></returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public List <TestCaseComponent> Generate(TestCaseComponentGeneratorOptions args)
        {
            var testCaseComponents = new List <TestCaseComponent>();

            if (args.Control.MaxLength > 0)
            {
                if (args.TestModuleConfig.IncludeNegativeTestCase)
                {
                    testCaseComponents.Add(GenerateGreaterThanMaxLengthTestCase(args.Control));
                }
                testCaseComponents.Add(GenerateEqualToMaxLengthTestCase(args.Control));
                testCaseComponents.Add(GenerateLessThanMaxLengthTestCase(args.Control));
            }

            return(testCaseComponents);
        }
コード例 #4
0
        /// <summary>
        /// Generates the specified arguments.
        /// </summary>
        /// <param name="args">The <see cref="T:Aurigo.Atom.Common.EventArgs.TestCaseComponentGeneratorEventArgs" /> instance containing the event data.</param>
        /// <returns></returns>
        public List <TestCaseComponent> Generate(TestCaseComponentGeneratorOptions args)
        {
            var testCaseComponents = new List <TestCaseComponent>();
            var result             = GeneratePositiveSecurityTestCase(args.Control);

            if (result != null)
            {
                testCaseComponents.Add(result);
            }

            result = GenerateNegativeSecurityTestCase(args.Control);

            if (result != null)
            {
                testCaseComponents.Add(result);
            }

            return(testCaseComponents);
        }
コード例 #5
0
        /// <summary>
        /// Builds this instance.
        /// </summary>
        /// <returns></returns>
        public List <TestCaseComponentGroup> Build()
        {
            var testCaseComponentGroups = new List <TestCaseComponentGroup>();

            foreach (var testComponent in _testCaseComponents)
            {
                var controlName = testComponent.Name;
                var controlType = testComponent.Control.Type;

                if (controlName == _testModuleConfig.AutomationGuidFieldName)
                {
                    continue;
                }

                var testCaseComponentGroup = new TestCaseComponentGroup
                {
                    ControlName        = controlName,
                    TestCaseComponents = new List <TestCaseComponent>()
                };

                var controlConfig = Configurator.TestCaseComponentConfig.Controls
                                    .FirstOrDefault(c => c.Type == controlType);

                if (controlConfig == null)
                {
                    continue;
                }

                foreach (var attribute in testComponent.Attribues)
                {
                    var attributeConfig = controlConfig.Attributes.Find(a => a.Name == attribute);

                    if (attributeConfig == null ||
                        !Configurator.Container.IsRegistered <ITestCaseComponentGenerator>(attributeConfig.GeneratorName))
                    {
                        continue;
                    }

                    var eventArgs = new TestCaseComponentGeneratorOptions
                    {
                        Control          = testComponent.Control,
                        TestModuleConfig = _testModuleConfig
                    };

                    var testCaseComponentGenerator = Configurator.Container.Resolve <ITestCaseComponentGenerator>(attributeConfig.GeneratorName);
                    var results = testCaseComponentGenerator?.Generate(eventArgs);

                    if (results != null && results.Count > 0)
                    {
                        testCaseComponentGroup.TestCaseComponents.AddRange(results);
                    }
                }

                if (testComponent.Attribues.Count == 0)
                {
                    if (Configurator.Container.IsRegistered <ITestCaseComponentGenerator>(controlConfig.DefaultValueGeneratorName))
                    {
                        var defaultValueEventArgs = new TestCaseComponentGeneratorOptions
                        {
                            Control          = testComponent.Control,
                            TestModuleConfig = _testModuleConfig
                        };

                        var testCaseDefaultValueGenerator = Configurator.Container.Resolve <ITestCaseComponentGenerator>(controlConfig.DefaultValueGeneratorName);
                        var defaultValueResult            = testCaseDefaultValueGenerator?.Generate(defaultValueEventArgs);

                        if (defaultValueResult != null && defaultValueResult.Count > 0)
                        {
                            testCaseComponentGroup.TestCaseComponents.AddRange(defaultValueResult);
                        }
                    }
                }

                if (_testModuleConfig.IncludeSecurityTestCase)
                {
                    if (Configurator.Container.IsRegistered <ITestCaseComponentGenerator>(controlConfig.SecurityTestCaseGeneratorName))
                    {
                        var securityTestEventArgs = new TestCaseComponentGeneratorOptions
                        {
                            Control          = testComponent.Control,
                            TestModuleConfig = _testModuleConfig
                        };

                        var securityTestCaseGenerator = Configurator.Container.Resolve <ITestCaseComponentGenerator>(controlConfig.SecurityTestCaseGeneratorName);
                        var securityTestResult        = securityTestCaseGenerator?.Generate(securityTestEventArgs);

                        if (securityTestResult != null && securityTestResult.Count > 0)
                        {
                            testCaseComponentGroup.TestCaseComponents.AddRange(securityTestResult);
                        }
                    }
                }

                if (testCaseComponentGroup.TestCaseComponents.Count > 0)
                {
                    testCaseComponentGroups.Add(testCaseComponentGroup);
                }
            }

            return(testCaseComponentGroups);
        }