Esempio n. 1
0
        /// <summary>
        ///     Creates a test case in the enclosing test sub sequence
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected TestCase CreateTestCase(SubSequence enclosing, string name)
        {
            TestCase retVal = (TestCase)Factory.createTestCase();

            enclosing.appendTestCases(retVal);
            retVal.Name = name;

            return(retVal);
        }
Esempio n. 2
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");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Imports the subsequence stored in the database
        /// </summary>
        /// <param name="frame"></param>
        private void importInitialValues(DataDictionary.Tests.SubSequence subSequence, int subSequenceID)
        {
            // Level is a reserved word...
            string sql = "SELECT D_LRBG, TSW_TestSeqSCItl.Level, Mode, NID_LRBG, Q_DIRLRBG, Q_DIRTRAIN, Q_DLRBG, RBC_ID, RBCPhone FROM TSW_TestSeqSCItl WHERE TestSequenceID = " + subSequenceID;

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

            adapter.Fill(dataSet);
            if (dataSet.Tables.Count > 0)
            {
                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    int    i          = 0;
                    string D_LRBG     = dataRow.ItemArray.GetValue(i++) as string;
                    string Level      = dataRow.ItemArray.GetValue(i++) as string;
                    string Mode       = dataRow.ItemArray.GetValue(i++) as string;
                    string NID_LRBG   = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRLRBG  = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRTRAIN = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DLRBG    = dataRow.ItemArray.GetValue(i++) as string;
                    string RBC_ID     = dataRow.ItemArray.GetValue(i++) as string;
                    string RBCPhone   = dataRow.ItemArray.GetValue(i++) as string;

                    subSequence.setD_LRBG(D_LRBG);
                    subSequence.setLevel(Level);
                    subSequence.setMode(Mode);
                    subSequence.setNID_LRBG(NID_LRBG);
                    subSequence.setQ_DIRLRBG(Q_DIRLRBG);
                    subSequence.setQ_DIRTRAIN(Q_DIRTRAIN);
                    subSequence.setQ_DLRBG(Q_DLRBG);
                    subSequence.setRBC_ID(RBC_ID);
                    subSequence.setRBCPhone(RBCPhone);

                    DataDictionary.Tests.TestCase testCase = (DataDictionary.Tests.TestCase)DataDictionary.Generated.acceptor.getFactory().createTestCase();
                    testCase.Name = "Setup";
                    subSequence.appendTestCases(testCase);

                    DataDictionary.Tests.Step initializeTrainDataStep = (DataDictionary.Tests.Step)DataDictionary.Generated.acceptor.getFactory().createStep();;
                    initializeTrainDataStep.setTCS_Order(0);
                    initializeTrainDataStep.setDistance(0);
                    initializeTrainDataStep.setDescription("Initialize train data");
                    initializeTrainDataStep.setTranslationRequired(true);
                    testCase.appendSteps(initializeTrainDataStep);

                    DataDictionary.Tests.Step setupStep = (DataDictionary.Tests.Step)DataDictionary.Generated.acceptor.getFactory().createStep();;
                    setupStep.setTCS_Order(0);
                    setupStep.setDistance(0);
                    setupStep.setDescription("Setup test sequence");
                    setupStep.setTranslationRequired(true);
                    testCase.appendSteps(setupStep);

                    DataDictionary.Tests.Step manualSetupStep = (DataDictionary.Tests.Step)DataDictionary.Generated.acceptor.getFactory().createStep();;
                    manualSetupStep.setTCS_Order(0);
                    manualSetupStep.setDistance(0);
                    manualSetupStep.setDescription("Manual setup test sequence");
                    manualSetupStep.setTranslationRequired(true);
                    testCase.appendSteps(manualSetupStep);
                }
            }
            else
            {
                Log.Error("Cannot find entry in table TSW_TestSeqSCItl WHERE TestSequenceID = " + subSequenceID);
            }
        }
        /// <summary>
        ///     Imports the steps in a sub sequence
        /// </summary>
        /// <param name="subSequence"></param>
        private void importSteps(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)
            {
                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 = (TestCase) acceptor.getFactory().createTestCase();
                            testCase.Name = "Feature " + feature + " Test case " + testCaseNr;
                            testCase.setCase(testCaseNr);
                            testCase.setFeature(feature);
                            subSequence.appendTestCases(testCase);
                            Step setupTestCaseStep = (Step) acceptor.getFactory().createStep();
                            setupTestCaseStep.Name = "Setup test case";
                            setupTestCaseStep.setDescription(setupTestCaseStep.Name);
                            setupTestCaseStep.setComment("This step is used to setup the test case " + testCaseNr +
                                                         " feature " + feature);
                            setupTestCaseStep.setTranslationRequired(true);
                            testCase.appendSteps(setupTestCaseStep);
                        }

                        Step step = (Step) 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");
            }
        }
        /// <summary>
        ///     Imports the subsequence stored in the database
        /// </summary>
        /// <param name="frame"></param>
        private void importInitialValues(SubSequence subSequence, int subSequenceID)
        {
            // Level is a reserved word...
            string sql =
                "SELECT D_LRBG, TSW_TestSeqSCItl.Level, Mode, NID_LRBG, Q_DIRLRBG, Q_DIRTRAIN, Q_DLRBG, RBC_ID, RBCPhone FROM TSW_TestSeqSCItl WHERE TestSequenceID = " +
                subSequenceID;

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

            adapter.Fill(dataSet);
            if (dataSet.Tables.Count > 0)
            {
                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    int i = 0;
                    string D_LRBG = dataRow.ItemArray.GetValue(i++) as string;
                    string Level = dataRow.ItemArray.GetValue(i++) as string;
                    string Mode = dataRow.ItemArray.GetValue(i++) as string;
                    string NID_LRBG = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRLRBG = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRTRAIN = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DLRBG = dataRow.ItemArray.GetValue(i++) as string;
                    string RBC_ID = dataRow.ItemArray.GetValue(i++) as string;
                    string RBCPhone = dataRow.ItemArray.GetValue(i++) as string;

                    subSequence.setD_LRBG(D_LRBG);
                    subSequence.setLevel(Level);
                    subSequence.setMode(Mode);
                    subSequence.setNID_LRBG(NID_LRBG);
                    subSequence.setQ_DIRLRBG(Q_DIRLRBG);
                    subSequence.setQ_DIRTRAIN(Q_DIRTRAIN);
                    subSequence.setQ_DLRBG(Q_DLRBG);
                    subSequence.setRBC_ID(RBC_ID);
                    subSequence.setRBCPhone(RBCPhone);

                    TestCase testCase = (TestCase) acceptor.getFactory().createTestCase();
                    testCase.Name = "Setup";
                    subSequence.appendTestCases(testCase);

                    Step initializeTrainDataStep = (Step) acceptor.getFactory().createStep();
                    ;
                    initializeTrainDataStep.setTCS_Order(0);
                    initializeTrainDataStep.setDistance(0);
                    initializeTrainDataStep.setDescription("Initialize train data");
                    initializeTrainDataStep.setTranslationRequired(true);
                    testCase.appendSteps(initializeTrainDataStep);

                    Step DefaultValuesStep = (Step) acceptor.getFactory().createStep();
                    ;
                    DefaultValuesStep.setTCS_Order(0);
                    DefaultValuesStep.setDistance(0);
                    DefaultValuesStep.setDescription("Set default values");
                    DefaultValuesStep.setTranslationRequired(true);
                    testCase.appendSteps(DefaultValuesStep);

                    Step manualSetupStep = (Step) acceptor.getFactory().createStep();
                    ;
                    manualSetupStep.setTCS_Order(0);
                    manualSetupStep.setDistance(0);
                    manualSetupStep.setDescription("Manual setup test sequence");
                    manualSetupStep.setTranslationRequired(false);
                    testCase.appendSteps(manualSetupStep);
                }
            }
            else
            {
                Log.Error("Cannot find entry in table TSW_TestSeqSCItl WHERE TestSequenceID = " + subSequenceID);
            }
        }
        /// <summary>
        ///     Creates a test case in the enclosing test sub sequence
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected TestCase CreateTestCase(SubSequence enclosing, string name)
        {
            TestCase retVal = (TestCase) Factory.createTestCase();
            enclosing.appendTestCases(retVal);
            retVal.Name = name;

            return retVal;
        }
Esempio n. 7
0
        /// <summary>
        ///     Imports the subsequence stored in the database
        /// </summary>
        /// <param name="subSequence"></param>
        /// <param name="subSequenceId"></param>
        private void ImportInitialValues(SubSequence subSequence, int subSequenceId)
        {
            // Level is a reserved word...
            string sql =
                "SELECT D_LRBG, TSW_TestSeqSCItl.Level, Mode, NID_LRBG, Q_DIRLRBG, Q_DIRTRAIN, Q_DLRBG, RBC_ID, RBCPhone FROM TSW_TestSeqSCItl WHERE TestSequenceID = " +
                subSequenceId;

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

            adapter.Fill(dataSet);
            if (dataSet.Tables.Count > 0)
            {
                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    int i = 0;
                    // ReSharper disable InconsistentNaming
                    string D_LRBG     = dataRow.ItemArray.GetValue(i++) as string;
                    string Level      = dataRow.ItemArray.GetValue(i++) as string;
                    string Mode       = dataRow.ItemArray.GetValue(i++) as string;
                    string NID_LRBG   = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRLRBG  = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DIRTRAIN = dataRow.ItemArray.GetValue(i++) as string;
                    string Q_DLRBG    = dataRow.ItemArray.GetValue(i++) as string;
                    string RBC_ID     = dataRow.ItemArray.GetValue(i++) as string;
                    string RBCPhone   = dataRow.ItemArray.GetValue(i++) as string;
                    // ReSharper restore InconsistentNaming

                    subSequence.setD_LRBG(D_LRBG);
                    subSequence.setLevel(Level);
                    subSequence.setMode(Mode);
                    subSequence.setNID_LRBG(NID_LRBG);
                    subSequence.setQ_DIRLRBG(Q_DIRLRBG);
                    subSequence.setQ_DIRTRAIN(Q_DIRTRAIN);
                    subSequence.setQ_DLRBG(Q_DLRBG);
                    subSequence.setRBC_ID(RBC_ID);
                    subSequence.setRBCPhone(RBCPhone);

                    TestCase testCase = (TestCase)acceptor.getFactory().createTestCase();
                    testCase.Name = "Setup";
                    subSequence.appendTestCases(testCase);

                    Step initializeTrainDataStep = (Step)acceptor.getFactory().createStep();

                    initializeTrainDataStep.setTCS_Order(0);
                    initializeTrainDataStep.setDistance("0");
                    initializeTrainDataStep.setDescription("Initialize train data");
                    initializeTrainDataStep.setTranslationRequired(true);
                    testCase.appendSteps(initializeTrainDataStep);

                    Step defaultValuesStep = (Step)acceptor.getFactory().createStep();

                    defaultValuesStep.setTCS_Order(0);
                    defaultValuesStep.setDistance("0");
                    defaultValuesStep.setDescription("Set default values");
                    defaultValuesStep.setTranslationRequired(true);
                    testCase.appendSteps(defaultValuesStep);

                    Step manualSetupStep = (Step)acceptor.getFactory().createStep();

                    manualSetupStep.setTCS_Order(0);
                    manualSetupStep.setDistance("0");
                    manualSetupStep.setDescription("Manual setup test sequence");
                    manualSetupStep.setTranslationRequired(false);
                    testCase.appendSteps(manualSetupStep);
                }
            }
            else
            {
                throw new Exception("Cannot find entry in table TSW_TestSeqSCItl WHERE TestSequenceID = " + subSequenceId);
            }
        }
        /// <summary>
        ///     Imports the steps in a sub sequence
        /// </summary>
        /// <param name="subSequence"></param>
        private void ImportSteps(SubSequence subSequence)
        {
            const 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)
            {
                TestCase testCase = null;
                int previousDistance = 0;

                foreach (DataRow dataRow in dataSet.Tables[0].Rows)
                {
                    object[] items = dataRow.ItemArray;
                    int order = (int) items[0];
                    string distance = ((int) items[1]).ToString(CultureInfo.InvariantCulture) + ".0";
                    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 = (TestCase) acceptor.getFactory().createTestCase();
                            testCase.Name = "Feature " + feature + " Test case " + testCaseNr;
                            testCase.setCase(testCaseNr);
                            testCase.setFeature(feature);
                            subSequence.appendTestCases(testCase);
                            Step setupTestCaseStep = (Step) acceptor.getFactory().createStep();
                            setupTestCaseStep.Name = "Setup test case";
                            setupTestCaseStep.setDistance(distance);
                            setupTestCaseStep.setDescription(setupTestCaseStep.Name);
                            setupTestCaseStep.setComment("This step is used to setup the test case " + testCaseNr +
                                                         " feature " + feature);
                            setupTestCaseStep.setTranslationRequired(true);
                            testCase.appendSteps(setupTestCaseStep);
                        }

                        Step step = (Step) 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);
                        }

                        //Steps who's distance goes back to 0 are steps that don't exist in the related word file. We import them immediately as manual translations linked to the appropriate comment.
                        if (previousDistance > 0 && (int)items[1] == 0)
                        {
                            step.setTranslationRequired(false);
                            step.setTranslated(true);
                            DataDictionary.ModelElement modelElement = GuidCache.Instance.GetModel("1c0febd1-8736-452d-9d17-14971b39b5b5");
                            if (modelElement != null)
                            {
                                Paragraph paragraph = modelElement as Paragraph;

                                if (paragraph != null)
                                {
                                    step.FindOrCreateReqRef(paragraph);
                                }
                                else
                                {
                                    throw new Exception("Guid error : the Guid for \"Step not translated. It does not appear in the test description\" does not reference a paragraph.");
                                }
                            }
                            else
                            {
                                throw new Exception("Guid error : the Guid for \"Step not translated. It does not appear in the test description\" does not reference anything.");
                            }
                        }
                        else
                        {
                            step.setTranslationRequired(true);
                            previousDistance = (int)items[1];
                        }

                        ImportStepMessages(step);

                        testCase.appendSteps(step);

                    }
                }
            }
            else
            {
                throw new Exception("Cannot find sub sequence table in database");
            }
        }