Exemple #1
0
        /// <summary>
        /// Imports the steps in a sub sequence
        /// </summary>
        /// <param name="subSequence"></param>
        private void importSteps(DataDictionary.Tests.SubSequence subSequence)
        {
            string sql = "SELECT TCSOrder, Distance, FT_NUMBER, TC_NUMBER, ST_STEP, ST_DESCRIPTION, UserComment, ST_IO, ST_INTERFACE, ST_COMMENTS, TestLevelIn, TestLevelOut, TestModeIn, TestModeOut FROM TSW_TCStep ORDER BY TCSOrder";

            OleDbDataAdapter adapter = new OleDbDataAdapter(sql, Connection);
            DataSet          dataSet = new DataSet();

            adapter.Fill(dataSet);
            if (dataSet.Tables.Count > 0)
            {
                DataDictionary.Tests.TestCase testCase = null;

                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    object[] items        = dataRow.ItemArray;
                    int      order        = (int)items[0];
                    int      distance     = (int)items[1];
                    int      feature      = (int)items[2];
                    int      testCaseNr   = (int)items[3];
                    string   stepType     = items[4] as string;
                    string   description  = items[5] as string;
                    string   userComment  = items[6] as string;
                    string   io           = items[7] as string;
                    string   intrface     = items[8] as string;
                    string   comment      = items[9] as string;
                    string   testLevelIn  = items[10] as string;
                    string   testLevelOut = items[11] as string;
                    string   testModeIn   = items[12] as string;
                    string   testModeOut  = items[13] as string;

                    // we do not want to import steps "Followed by" or "Preceded by"
                    if (io != null && stepType != null && !stepType.Equals("Followed by") && !stepType.Equals("Preceded by"))
                    {
                        if (testCase != null)
                        {
                            if (testCase.getFeature() != feature || testCase.getCase() != testCaseNr)
                            {
                                testCase = null;
                            }
                        }

                        if (testCase == null)
                        {
                            testCase      = (DataDictionary.Tests.TestCase)DataDictionary.Generated.acceptor.getFactory().createTestCase();
                            testCase.Name = "Feature " + feature + " Test case " + testCaseNr;
                            testCase.setCase(testCaseNr);
                            testCase.setFeature(feature);
                            subSequence.appendTestCases(testCase);
                        }

                        DataDictionary.Tests.Step step = (DataDictionary.Tests.Step)DataDictionary.Generated.acceptor.getFactory().createStep();
                        step.Name = "Step " + order;
                        step.setTCS_Order(order);
                        step.setDistance(distance);
                        step.setDescription(description);
                        step.setUserComment(userComment);
                        step.setIO_AsString(io);
                        if (intrface != null)
                        {
                            step.setInterface_AsString(intrface);
                        }
                        step.setComment(comment);
                        if (testLevelIn != null)
                        {
                            step.setLevelIN_AsString(testLevelIn);
                        }
                        if (testLevelOut != null)
                        {
                            step.setLevelOUT_AsString(testLevelOut);
                        }
                        if (testModeIn != null)
                        {
                            step.setModeIN_AsString(testModeIn);
                        }
                        if (testModeOut != null)
                        {
                            step.setModeOUT_AsString(testModeOut);
                        }
                        step.setTranslationRequired(true);

                        importStepMessages(step);

                        testCase.appendSteps(step);
                    }
                }
            }
            else
            {
                Log.Error("Cannot find sub sequence table in database");
            }
        }