Пример #1
0
        /// <summary>
        /// Handler for the CodeActivity7 Activity’s ExecuteEvent event.
        /// </summary>

        public void CodeActivity7_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            // initialize output parameter with default values
            this.CodeActivity7.Output.Out_QParameter   = this.CodeActivity7.Input.QParameter;
            this.CodeActivity7.Output.Out_SQLParameter = this.CodeActivity7.Input.SQLQueryToValidateData;

            //Check database connection and retrieve reocrds from database.
            OpenDBConnection(this.CodeActivity7.Input.DBConnectionString);

            //Verify whether SQLQuery exist
            if (this.CodeActivity7.Input.SQLToFetchData.Length > 0)
            {
                //Fetch the dymanic value for customising the URL from the database
                dataRows = GetRecordsFromDB(this.CodeActivity7.Input.SQLToFetchData, this.CodeActivity7);

                rowObject = dataRows[0].ItemArray;
                //Verify data columns exist before fetching data
                if (rowObject.Length > 0)
                {
                    firstDynamicData = rowObject[0].ToString();

                    //verify whether second data column exist
                    if (rowObject.Length > 1)
                    {
                        secondDynamicData = rowObject[1].ToString();
                    }

                    this.CodeActivity7.Output.Out_QParameter   = this.CodeActivity7.Output.Out_QParameter.Replace("XXX", firstDynamicData).Replace("YYY", secondDynamicData);
                    this.CodeActivity7.Output.Out_SQLParameter = this.CodeActivity7.Input.SQLQueryToValidateData.Replace("XXX", firstDynamicData).Replace("YYY", secondDynamicData);
                }
            }

            //Close DB connection
            CloseDBConnection();
        }
Пример #2
0
        /// <summary>
        /// Handler for the CodeActivity4 Activity’s ExecuteEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.CodeActivity4 to access the CodeActivity4 Activity's context, including input and output properties.
        public void CodeActivity4_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            var ActivityArguments = args.Activity.StepId.ToString();

            this.CodeActivity4.Report("Overall report", ActivityArguments);
            var ActivityArguments2 = args.Activity.StepId.ToString();

            this.CodeActivity4.Report("Overall report", ActivityArguments2);
        }
Пример #3
0
        /// <summary>
        /// Handler for the Loop2 Activity’s Condition event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the Condition event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.Loop2 to access the Loop2 Activity's context, including input and output properties.
        public bool Loop2_OnCondition(object sender, STActivityBaseEventArgs args)
        {
            bool isIterationStatusAvailable = true;

            // Assign iteration status depending on the load testing status
            if (Convert.ToBoolean(SwitchEnvironment27.IsLoadTestEnabled) == true)
            {
                isIterationStatusAvailable = false;
            }
            else
            {
                // Fetch the value of iteration numbers
                Loop2.NumberOfIterations = GetDataSource("MTC029").RowsCount;
                if (Loop2.CurrentIterationNumber > Loop2.NumberOfIterations - 1)
                {
                    isIterationStatusAvailable = false;
                }
            }
            return(isIterationStatusAvailable);
        }
Пример #4
0
        /// <summary>
        /// Handler for the CodeActivity21 Activity’s ExecuteEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.CodeActivity21 to access the CodeActivity21 Activity's context, including input and output properties.
        public void CodeActivity21_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            //Initialize checkArgsPoint object
            checkArgs = new CheckpointEventArgs(this.CodeActivity21);
            //open Database connection
            OpenDBConnection(this.CodeActivity21.Input.connectionString);

            //Get the record from the database
            datarowsMaster = GetRecords.GetRecordsFromDatabase(connection, command, dataAdapter, jenkinsHandle(this.SwitchEnvironment27.pEnvironment, this.CodeActivity21.Input.sqlQueryMaster, jenkinsDataSource));

            //check record count
            CheckDataRowsCount(datarowsMaster.Count, this.CodeActivity21);

            // Get the Master customer Id
            this.CodeActivity21.Output.Mstr_Cust_Id = datarowsMaster[0].ItemArray[0].ToString();

            //Replace placeholders in request body
            string requestBody = this.CodeActivity21.Input.requestBody.Replace("Master_Cust_Id_value", this.CodeActivity21.Output.Mstr_Cust_Id).ToString();

            if (this.CodeActivity21.Input.caseType.ToUpper() == "MASTERANDBRANCH")
            {
                datarowsBranch = GetRecords.GetRecordsFromDatabase(connection, command, dataAdapter, jenkinsHandle(this.SwitchEnvironment27.pEnvironment,
                                                                                                                   this.CodeActivity21.Input.sqlQueryBranch.Replace("mstr_cust_id_value", datarowsMaster[0].ItemArray[0].ToString()), jenkinsDataSource));

                CheckDataRowsCount(datarowsBranch.Count, this.CodeActivity21);

                //Replace placeholders in request body
                requestBody = requestBody.Replace("Branch_Cust_Id_value", datarowsBranch[0].ItemArray[0].ToString().Split('*')[1]).
                              Replace("Branch_Cust_Acct", datarowsBranch[0].ItemArray[0].ToString().Split('*')[0]);
            }

            this.CodeActivity21.Output.requestBodyOut = requestBody;

            //Close database connection
            CloseDBConnection();
        }
Пример #5
0
 /// <summary>
 /// Handler for the CodeActivity4 Activity’s ExecuteEvent event.
 /// </summary>
 /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
 /// <param name=\"args\">The event arguments passed to the activity.</param>
 /// Use this.CodeActivity4 to access the CodeActivity4 Activity's context, including input and output properties.
 public void CodeActivity4_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
 {
     //TODO: Add your code here...
 }
Пример #6
0
 /// <summary>
 /// Handler for the StartActivity1 Activity’s BeforeExecution event.
 /// </summary>
 /// <param name=\"sender\">The activity object that raised the BeforeExecution event.</param>
 /// <param name=\"args\">The event arguments passed to the activity.</param>
 /// Use this.StartActivity1 to access the StartActivity1 Activity's context, including input and output properties.
 public void StartActivity1_OnBeforeExecution(object sender, STActivityBaseEventArgs args)
 {
 }
Пример #7
0
 /// <summary>
 /// Handler for the ReportMessageActivity45 Activity’s AfterExecuteStepEvent event.
 /// </summary>
 /// <param name=\"sender\">The activity object that raised the AfterExecuteStepEvent event.</param>
 /// <param name=\"args\">The event arguments passed to the activity.</param>
 /// Use this.ReportMessageActivity45 to access the ReportMessageActivity45 Activity's context, including input and output properties.
 public void ReportMessageActivity45_OnAfterExecuteStepEvent(object sender, STActivityBaseEventArgs args)
 {
     //TODO: Add your code here...
 }
Пример #8
0
 /// <summary>
 /// Handler for the FileWriteActivity27 Activity’s BeforeExecuteStepEvent event.
 /// </summary>
 /// <param name=\"sender\">The activity object that raised the BeforeExecuteStepEvent event.</param>
 /// <param name=\"args\">The event arguments passed to the activity.</param>
 /// Use this.FileWriteActivity27 to access the FileWriteActivity27 Activity's context, including input and output properties.
 public void FileWriteActivity27_OnBeforeExecuteStepEvent(object sender, STActivityBaseEventArgs args)
 {
     //TODO: Add your code here...
 }
Пример #9
0
        /// <summary>
        /// Handler for the CodeActivity17 Activity’s ExecuteEvent event.
        /// </summary>
        /// <param name=\"sender\">The activity object that raised the ExecuteEvent event.</param>
        /// <param name=\"args\">The event arguments passed to the activity.</param>
        /// Use this.CodeActivity17 to access the CodeActivity17 Activity's context, including input and output properties.
        public void CodeActivity17_OnExecuteEvent(object sender, STActivityBaseEventArgs args)
        {
            if (SwitchEnvironment14.IsLoadTestEnabled != "true")
            {
                int docArrayElementCount = 0;
                checkArgs = new CheckpointEventArgs(this.CodeActivity17);

                //Get the response
                XMLString = this.RESTActivityV24.ResponseBody;

                //Create Deserialize object
                DeserializedXMLproductResponse = XMLString.DeserializeFromXMLInput <ProductResponse>();

                //Customize the SQL Query for count
                customisedCountSqlQuery = "Select count(*) from (" + this.CodeActivity7.Output.Out_SQLParameter + ")";

                //Customize the SQL Query
                customisedSqlQuery = this.CodeActivity7.Output.Out_SQLParameter;

                //opening the DB conenction
                OpenDBConnection(this.CodeActivity7.Input.DBConnectionString);

                //Get the record from the database
                record = GetRecord(customisedCountSqlQuery, customisedSqlQuery, this.CodeActivity17);

                //verify database records count
                checkArgs.Checkpoint.Assert.Equals("", DeserializedXMLproductResponse.RowsTotal.ToString(), record.RecordsCount.ToString(), "Records count");

                //Verify product data
                foreach (Product doc_ProductNote in DeserializedXMLproductResponse.Products.Product)
                {
                    //isRecordAvailable = false;
                    foreach (Product2DTO recordNote in record.Product)
                    {
                        //Compare product Primary key
                        if (doc_ProductNote.ProductId.ToString() == recordNote.productId)
                        {
                            string altCodes = sortString(recordNote.altCodes);

                            //Verify productId
                            AssertIfNotNull(checkArgs, doc_ProductNote.ProductId, recordNote.productId, "Product V2 productId: " + docArrayElementCount);
                            //Verify productDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.Description, recordNote.description, "Product V2 prodDesc: " + docArrayElementCount);
                            //Verify discGroupId
                            AssertIfNotNull(checkArgs, doc_ProductNote.DiscGroupId, recordNote.discGroupId, "Product V2 discGroupId: " + docArrayElementCount);
                            //Verify discGroupDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.DiscGroupDesc, recordNote.discGroupDesc, "Product V2 discGroupDesc: " + docArrayElementCount);
                            //Verify linbuyId
                            AssertIfNotNull(checkArgs, doc_ProductNote.LinebuyId, recordNote.linebuyId, "Product V2 linebuyId: " + docArrayElementCount);
                            //Verify linebuyDesc
                            AssertIfNotNull(checkArgs, doc_ProductNote.LinebuyDesc, recordNote.linebuyDesc, "Product V2 linebuyDesc: " + docArrayElementCount);
                            //Verify altCode1
                            AssertIfNotNull(checkArgs, doc_ProductNote.Alt1Code, recordNote.alt1Code, "Product V2 altCode1: " + docArrayElementCount);
                            //Verify altCodes
                            AssertIfNotNull(checkArgs, sortString(doc_ProductNote.AltCodes.Trim()), sortString(recordNote.altCodes), "Product V2 altCodes: " + docArrayElementCount);
                            //Verify altCodeType
                            AssertIfNotNull(checkArgs, sortString(doc_ProductNote.AltCodeType.Trim()), sortString(recordNote.altCodeType), "Product V2 altCodeType: " + docArrayElementCount);

                            break;
                        }
                    }
                    docArrayElementCount++;
                }

                //closing the DB connection
                CloseDBConnection();
            }
        }