示例#1
0
        public void ShouldProcessSimpleBugzillaCustomField()
        {
            const string cfName  = "cf name";
            const string cfValue = "cf value";

            var field = new custom_field {
                cf_name = cfName, cf_value = cfValue
            };

            var info = new CustomFieldInfo(field);

            info.Name.Should(Be.EqualTo(cfName));
            info.Values.Should(Be.EquivalentTo(new[] { cfValue }));
        }
示例#2
0
        public void ShouldProcessCollectionBugzillaCustomField()
        {
            const string cfName   = "cf name";
            const string cfValue1 = "cf value1";
            const string cfValue2 = "cf value2";

            var field = new custom_field {
                cf_name = cfName, cf_type = "Multiple-Selection Box", cf_values = new cf_values {
                    cf_valueCollection = new cf_valueCollection {
                        cfValue1, cfValue2
                    }
                }
            };

            var info = new CustomFieldInfo(field);

            info.Name.Should(Be.EqualTo(cfName));
            info.Values.Should(Be.EquivalentTo(new[] { cfValue1, cfValue2 }));
        }
 private static IEnumerable <string> GetCustomFieldValue(custom_field bugzillaCustomField)
 {
     return(CustomFieldHasValue(bugzillaCustomField.cf_type, bugzillaCustomField.cf_value)
                         ? new[] { bugzillaCustomField.cf_value }
                         : Enumerable.Empty <string>());
 }
        private static IEnumerable <string> GetCustomFieldCollectionValue(custom_field field)
        {
            var values = field.cf_values.cf_valueCollection.Cast <string>().Where(ValueIsNotEmpty).ToList();

            return(values.Count > 0 ? values : Enumerable.Empty <string>());
        }
 private static bool IsCollection(custom_field bugzillaCustomField)
 {
     return("Multiple-Selection Box".Equals(bugzillaCustomField.cf_type, StringComparison.OrdinalIgnoreCase));
 }
 private static IEnumerable <string> GetBugzillaCustomFieldValues(custom_field bugzillaCustomField)
 {
     return(IsCollection(bugzillaCustomField)
                         ? GetCustomFieldCollectionValue(bugzillaCustomField)
                         : GetCustomFieldValue(bugzillaCustomField));
 }
 public CustomFieldInfo(custom_field source)
 {
     Name        = source.cf_name;
     Description = source.cf_description;
     Values      = GetBugzillaCustomFieldValues(source);
 }
示例#8
0
        public int addTestcases(Excel.Worksheet sheet, DefaultTC itc, int row)
        {
            itc.InitialTestcase(sheet, row);
            // testsuite ts=addItems(4,itc.GetCell(DefaultTC.colName.FEATUREID),itc.GetCell(DefaultTC.colName.FEATURE_DESC));

            string detail = itc.GetCell(DefaultTC.colName.FEATUREID) + ":" + itc.GetCell(DefaultTC.colName.CASE_DESC);

            testsuite ts = addItems(4, itc.GetCell(DefaultTC.colName.FEATURE_DESC), detail);

            string        preset     = itc.GetCell(DefaultTC.colName.PRESET);
            List <string> steps      = itc.getSteps();
            List <string> exp        = itc.getExpRsts();
            string        req        = itc.GetCell(DefaultTC.colName.DS_ID);
            bool          can_auto   = itc.GetCell(DefaultTC.colName.CAN_AUTO).ToLower().Equals("true");
            string        importance = itc.GetCell(DefaultTC.colName.PRIORITY).ToLower();
            string        testtype   = itc.GetCell(DefaultTC.colName.TYPE);

            uint order = 0;

            while (true)
            {
                row++;
                string c0 = itc.GetSubCase(row, DefaultTC.subColName.ID0);
                string c1 = itc.GetSubCase(row, DefaultTC.subColName.ID);

                if (c0.Length != 0 || c1.Length == 0)
                {
                    row--;
                    return(row);
                }

                string   c2 = itc.GetSubCase(row, DefaultTC.subColName.SAMPLES);
                testcase tc = new testcase();
                tc.name           = c1;
                tc.externalid     = externalid++;
                tc.internalid     = externalid + "";
                tc.node_order     = order++;
                tc.version        = 1;
                tc.summary        = c2;
                tc.preconditions  = preset;
                tc.execution_type = (uint)(can_auto ? 2 : 1);
                if (importance.Length > 5)
                {
                    tc.importance = Convert.ToUInt32(importance.Substring(5, 1));
                }
                else
                {
                    tc.importance = 1;
                }
                custom_field test_type = new custom_field();
                test_type.name  = "test_type";
                test_type.value = testtype;
                tc.custom_fields.Add(test_type);

                //todo 需求没有处理
                //string reqs= itc.GetSubCase(row,DefaultTC.subColName.REQ);
                //requirement rq=new requirement();

                //tc.requirements.Add

                for (int i = 0; i < steps.Count; i++)
                {
                    step s = new step();
                    s.actions         = steps[i];
                    s.expectedresults = exp[i];
                    s.step_number     = (uint)(i + 1);
                    s.execution_type  = tc.execution_type;
                    tc.steps.Add(s);
                }

                ts.Items.Add(tc);
            }
        }