Beispiel #1
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);
            }
        }
 public static bool LoadFromFile(string fileName, out testcase obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool Deserialize(string xml, out testcase obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an testcase object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output testcase object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out testcase obj, out System.Exception exception)
 {
     exception = null;
     obj = default(testcase);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an testcase object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output testcase object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out testcase obj, out System.Exception exception)
 {
     exception = null;
     obj = default(testcase);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }