예제 #1
0
        /// <summary>
        /// Start listening for requests.
        /// </summary>
        public void Start()
        {
            lock (this.lockObject)
            {
                Thread oldThread = null;

                // If thread is currently running
                if (this.IsListening)
                {
                    if (!this.threadData.StopRequestSent)
                    {
                        // Thread is already running and ready to handle requests, so there
                        // is no need to start up a new one.
                        return;
                    }

                    // If thread is running, but still in the process of winding down,
                    // dissociate server from currently running thread without waiting for
                    // thread to finish.
                    // New thread will wait for previous thread to finish so that there is
                    // no conflict between two different threads listening on the same URI
                    // prefixes.
                    oldThread       = this.threadData.Thread;
                    this.threadData = null;
                }

                this.threadData = new SharedThreadData
                {
                    Thread         = new Thread(this.ListenerThread),
                    PreviousThread = oldThread
                };
                this.threadData.Thread.Start(this.threadData);
            }
        }
예제 #2
0
        /// <summary>
        /// Let listener thread know that it should wind down and stop listening for incoming
        /// HTTP requests.
        /// </summary>
        /// <param name="threadData">
        /// Object containing shared data used to communicate with listener thread.
        /// </param>
        private static void SendStopMessage(SharedThreadData threadData)
        {
            if (threadData.StateManager != null)
            {
                // If there's already a state manager associated with the server thread,
                // tell it to stop listening.
                threadData.StateManager.Stop();
            }

            // Even if there's no dispatcher associated with the server thread yet,
            // let thread know that it should bail out immediately after starting
            // up, and never push a dispatcher frame at all.
            threadData.StopRequestSent = true;
        }
        public void Test_PreRequest(object sender, PreRequestEventArgs e)
        {
            System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            SharedThreadData threadData = CommonFunctions.getThreadDataByScenarioName(Convert.ToInt32(e.WebTest.Context.WebTestUserId), e.WebTest.Name);

            if (threadData.SessionId != null && threadData.OrganizationId != null)
            {
                if (threadData.BNES_SID != null)
                {
                    e.Request.Headers.Add(new WebTestRequestHeader("Cookie", "SID=SessionId=" + threadData.SessionId + "&OrganisationId=" + threadData.OrganizationId + "&BNES_SID=" + threadData.BNES_SID));
                }
                else
                {
                    e.Request.Headers.Add(new WebTestRequestHeader("Cookie", "SID=SessionId=" + threadData.SessionId + "&OrganisationId=" + threadData.OrganizationId));
                }
            }
        }
예제 #4
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.UAS_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.UserAccessSettings);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_UserAccessSettings_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.UserAccessSettings + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.UserAccessSettings);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.UserAccessSettings + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_UserAccessSettings_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_UserAccessSettings_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.UserAccessSettings + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.UserAccessSettings);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.UserAccessSettings + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";


            #region UAS_GoToUserAccessSettings
            webTest.BeginTransaction(WebBTPrefix + "GoToUserAccessSettings");
            WebRequestPrefix = "GTUAS_";

            webTest.BeginTransaction(WebRequestPrefix + "UI");
            WebTestRequest request185 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/UI/"));
            request185.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/UI/#/Settings/Access");
            yield return(request185);

            request185 = null;
            webTest.EndTransaction(WebRequestPrefix + "UI");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_settings_access_access.html");
            WebTestRequest request186 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/settings/access/access.html"));
            request186.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request186.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request186);

            request186 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_settings_access_access.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");
            WebTestRequest request187 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-basic-group-tile.html"));
            request187.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request187.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request187);

            request187 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");
            WebTestRequest request188 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-links-tile.html"));
            request188.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request188.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request188);

            request188 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks");
            WebTestRequest request189 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request189.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request189.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request189);

            request189 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks");

            webTest.EndTransaction(WebBTPrefix + "GoToUserAccessSettings");
            #endregion

            #region UAS_ClickOnUsers
            webTest.BeginTransaction(WebBTPrefix + "ClickOnUsers");
            WebRequestPrefix = "COU_";

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");
            WebTestRequest request190 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/home/classic/classic.html"));
            request190.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request190.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request190);

            request190 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");

            webTest.BeginTransaction(WebRequestPrefix + "masters_user_default.aspx");
            WebTestRequest request191 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx"));
            request191.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request191);

            request191 = null;
            webTest.EndTransaction(WebRequestPrefix + "masters_user_default.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks_1");
            WebTestRequest request192 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request192.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request192.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request192);

            request192 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks_1");

            webTest.BeginTransaction(WebRequestPrefix + "finder_default.aspx");
            WebTestRequest request193 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/finder/default.aspx"));
            request193.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*"));
            request193.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx")));
            request193.QueryStringParameters.Add("accessrules", "1", false, false);
            request193.QueryStringParameters.Add("mutualoffices", "1", false, false);
            request193.QueryStringParameters.Add("page", "0", false, false);
            request193.QueryStringParameters.Add("pattern", "", false, false);
            request193.QueryStringParameters.Add("type", "USR", false, false);
            yield return(request193);

            request193 = null;
            webTest.EndTransaction(WebRequestPrefix + "finder_default.aspx");

            webTest.EndTransaction(WebBTPrefix + "ClickOnUsers");
            #endregion

            //Random user name

            string CreateUserName = Guid.NewGuid().ToString("n").Substring(0, 4);

            string PassCreateName = "Perf_" + CreateUserName;

            #region UAS_CreateUser
            webTest.BeginTransaction(WebBTPrefix + "CreateUser");
            WebRequestPrefix = "CU_";

            webTest.BeginTransaction(WebRequestPrefix + "finder_default.aspx_1");
            WebTestRequest request194 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/finder/default.aspx"));
            request194.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*"));
            request194.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx")));
            request194.QueryStringParameters.Add("accessrules", "1", false, false);
            request194.QueryStringParameters.Add("mutualoffices", "1", false, false);
            request194.QueryStringParameters.Add("page", "0", false, false);
            request194.QueryStringParameters.Add("pattern", PassCreateName, false, false);
            request194.QueryStringParameters.Add("type", "USR", false, false);
            yield return(request194);

            request194 = null;
            webTest.EndTransaction(WebRequestPrefix + "finder_default.aspx_1");

            webTest.BeginTransaction(WebRequestPrefix + "masters_user_overview.aspx");
            WebTestRequest request152 = new WebTestRequest(webTest.Context["AccountingURL"].ToString() + "/masters/user/overview.aspx");
            request152.Method = "POST";
            request152.Headers.Add(new WebTestRequestHeader("Referer", webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx"));
            FormPostHttpBody request152Body = new FormPostHttpBody();
            request152Body.FormPostParameters.Add("txtCode", PassCreateName);
            request152Body.FormPostParameters.Add("btnNext.x", "Next >");
            //request152Body.FormPostParameters.Add("__ncforminfo", webTest.Context["$HIDDEN1.__ncforminfo"].ToString());
            request152.Body = request152Body;
            ExtractHiddenFields extractionRule3 = new ExtractHiddenFields();
            extractionRule3.Required             = true;
            extractionRule3.HtmlDecode           = true;
            extractionRule3.ContextParameterName = "1";
            request152.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule3.Extract);
            yield return(request152);

            request152 = null;
            webTest.EndTransaction(WebRequestPrefix + "masters_user_overview.aspx");

            webTest.EndTransaction(WebBTPrefix + "CreateUser");
            #endregion

            #region UAS_GoToCompaniesTab
            webTest.BeginTransaction(WebBTPrefix + "GoToCompaniesTab");
            WebRequestPrefix = "GTCT_";

            webTest.BeginTransaction(WebRequestPrefix + "masters_user_overview.aspx_1");
            WebTestRequest request155 = new WebTestRequest(webTest.Context["AccountingURL"].ToString() + "/masters/user/overview.aspx");
            request155.Method = "POST";
            request155.Headers.Add(new WebTestRequestHeader("Referer", webTest.Context["AccountingURL"].ToString() + "/masters/user/overview.aspx"));
            FormPostHttpBody request155Body = new FormPostHttpBody();
            request155Body.FormPostParameters.Add("txtCode", PassCreateName);
            request155Body.FormPostParameters.Add("txtName", PassCreateName);
            request155Body.FormPostParameters.Add("txtShortName", PassCreateName);
            request155Body.FormPostParameters.Add("txtPassword1", "Twinfield01");
            request155Body.FormPostParameters.Add("txtPassword2", "Twinfield01");
            request155Body.FormPostParameters.Add("txtEmail", "*****@*****.**");
            request155Body.FormPostParameters.Add("lstCulture", "en-GB");
            request155Body.FormPostParameters.Add("txtFreetext1", "");
            request155Body.FormPostParameters.Add("txtFreetext2", "");
            request155Body.FormPostParameters.Add("txtFreetext3", "");
            request155Body.FormPostParameters.Add("lstRole", "LVL1");//"BOX");//
            request155Body.FormPostParameters.Add("lstType", "accountant");
            request155Body.FormPostParameters.Add("chkAcceptExtraCost", "1");
            request155Body.FormPostParameters.Add("selectedAcceptExtraCost", "1");
            request155Body.FormPostParameters.Add("smsPhoneNumber", "");
            request155Body.FormPostParameters.Add("txtQuota", "");
            request155Body.FormPostParameters.Add("txtFMQuota", "5");
            request155Body.FormPostParameters.Add("txtTab", "tabOffices");
            request155Body.FormPostParameters.Add("txtPrevTab", webTest.Context["$HIDDEN1.txtPrevTab"].ToString());
            request155Body.FormPostParameters.Add("id", webTest.Context["$HIDDEN1.id"].ToString());
            request155Body.FormPostParameters.Add("hdnRole", webTest.Context["$HIDDEN1.hdnRole"].ToString());
            request155Body.FormPostParameters.Add("txtDejavu", webTest.Context["$HIDDEN1.txtDejavu"].ToString());
            request155Body.FormPostParameters.Add("lstOfficeSort", webTest.Context["$HIDDEN1.lstOfficeSort"].ToString());
            //request155Body.FormPostParameters.Add("__ncforminfo", webTest.Context["$HIDDEN1.__ncforminfo"].ToString());
            request155.Body = request155Body;
            ExtractHiddenFields extractionRule4 = new ExtractHiddenFields();
            extractionRule4.Required             = true;
            extractionRule4.HtmlDecode           = true;
            extractionRule4.ContextParameterName = "0";
            request155.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule4.Extract);
            ExtractText extractionRule111 = new ExtractText();
            extractionRule111.StartsWith           = "<SELECT NAME=\"lstAvailable\"";
            extractionRule111.EndsWith             = "</SELECT>";
            extractionRule111.Index                = 0;
            extractionRule111.IgnoreCase           = false;
            extractionRule111.UseRegularExpression = false;
            extractionRule111.HtmlDecode           = true;
            extractionRule111.Required             = false;
            extractionRule111.ContextParameterName = "AllCompanies";
            request155.ExtractValues              += new EventHandler <ExtractionEventArgs>(extractionRule111.Extract);

            yield return(request155);

            request155 = null;
            webTest.EndTransaction(WebRequestPrefix + "masters_user_overview.aspx_1");


            string   AllCompanies = webTest.Context["AllCompanies"].ToString();
            string   StartString  = "<OPTION VALUE=\"";
            string   EndString    = "\">";
            int      OptionCount  = Regex.Matches(AllCompanies, "<OPTION VALUE=\"").Count;
            string[] matchFound   = CommonFunctions.GetBetween(AllCompanies, StartString, EndString, OptionCount);

            string listofCompanies = string.Empty;

            for (int i = 0; i < OptionCount; i++)
            {
                listofCompanies = listofCompanies + matchFound[i] + ";";
            }

            webTest.EndTransaction(WebBTPrefix + "GoToCompaniesTab");

            #endregion

            #region UAS_SelectAccessToAllCompanies
            webTest.BeginTransaction(WebBTPrefix + "SelectAccessToAllCompanies");
            WebRequestPrefix = "SATAC_";

            //WebTestRequest request206 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request206.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request206.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request206.QueryStringParameters.Add("since", "2018-08-14T12:19:03.336Z", false, false);
            //yield return request206;
            //request206 = null;

            webTest.EndTransaction(WebBTPrefix + "SelectAccessToAllCompanies");
            #endregion

            #region UAS_SaveUser
            webTest.BeginTransaction(WebBTPrefix + "SaveUser");
            WebRequestPrefix = "SU_";

            string[] Companyy      = listofCompanies.Split(';');
            string   CompanyToPass = string.Empty;
            foreach (string word in Companyy)
            {
                CompanyToPass += word;
            }

            webTest.BeginTransaction(WebRequestPrefix + "masters_user_overview.aspx_2");
            WebTestRequest request159 = new WebTestRequest(webTest.Context["AccountingURL"].ToString() + "/masters/user/overview.aspx");
            request159.Method = "POST";
            request159.ExpectedResponseUrl = webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx?code=" + PassCreateName +
                                             "&name=" + PassCreateName + "&msg=saveok";
            request159.Headers.Add(new WebTestRequestHeader("Referer", webTest.Context["AccountingURL"].ToString() + "/masters/user/overview.aspx"));
            FormPostHttpBody request159Body = new FormPostHttpBody();
            request159Body.FormPostParameters.Add("txtCode", webTest.Context["$HIDDEN0.txtCode"].ToString());
            request159Body.FormPostParameters.Add("radRestricted", webTest.Context["$HIDDEN0.radRestricted"].ToString());
            request159Body.FormPostParameters.Add("txtSearchSelected", "Finder�");
            request159Body.FormPostParameters.Add("txtSearchAvailable", "Finder�");
            request159Body.FormPostParameters.Add("lstSelected", CompanyToPass);
            request159Body.FormPostParameters.Add("lstOfficeSort", webTest.Context["$HIDDEN1.lstOfficeSort"].ToString());
            request159Body.FormPostParameters.Add("txtSelected", listofCompanies);
            request159Body.FormPostParameters.Add("txtDefaultOffice", CompanyToPass);
            request159Body.FormPostParameters.Add("txtDefaultOfficeName", CompanyToPass); //"GMO NFA L 4 (150 Assets) (GMO-NFA-L-4)");// GMO-NFA-L-1
            request159Body.FormPostParameters.Add("chkTemplateOffice", "");               // webTest.Context["$HIDDEN0.chkTemplateOffice"].ToString());
            request159Body.FormPostParameters.Add("btnSave.x", "Save");
            request159Body.FormPostParameters.Add("txtTab", webTest.Context["$HIDDEN0.txtTab"].ToString());
            request159Body.FormPostParameters.Add("txtPrevTab", webTest.Context["$HIDDEN0.txtPrevTab"].ToString());
            request159Body.FormPostParameters.Add("id", webTest.Context["$HIDDEN0.id"].ToString());
            request159Body.FormPostParameters.Add("hdnRole", webTest.Context["$HIDDEN0.hdnRole"].ToString());
            request159Body.FormPostParameters.Add("txtDejavu", webTest.Context["$HIDDEN0.txtDejavu"].ToString());
            //request159Body.FormPostParameters.Add("__ncforminfo", webTest.Context["$HIDDEN0.__ncforminfo"].ToString());
            request159.Body = request159Body;
            yield return(request159);

            request159 = null;
            webTest.EndTransaction(WebRequestPrefix + "masters_user_overview.aspx_2");


            webTest.BeginTransaction(WebRequestPrefix + "finder_default.aspx_2");
            WebTestRequest request209 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/finder/default.aspx"));
            request209.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*"));
            request209.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/masters/user/default.aspx?code=" + PassCreateName.ToUpper() + "&name=" + PassCreateName + "&msg=saveok")));
            request209.QueryStringParameters.Add("accessrules", "1", false, false);
            request209.QueryStringParameters.Add("mutualoffices", "1", false, false);
            request209.QueryStringParameters.Add("page", "0", false, false);
            request209.QueryStringParameters.Add("pattern", "", false, false);
            request209.QueryStringParameters.Add("type", "USR", false, false);
            yield return(request209);

            request209 = null;
            webTest.EndTransaction(WebRequestPrefix + "finder_default.aspx_2");

            webTest.EndTransaction(WebBTPrefix + "SaveUser");
            #endregion

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
        public void Test_PostRequest(object sender, PostRequestEventArgs e)
        {
            //var sharedThreadData = CustomDS.Instance.GetCreateInvoiceUserData_Web(Convert.ToInt32(e.WebTest.Context.WebTestUserId));

            SharedThreadData threadData = CommonFunctions.getThreadDataByScenarioName(Convert.ToInt32(e.WebTest.Context.WebTestUserId), e.WebTest.Name);

            if (e.Request.Url == e.WebTest.Context["LoginMain"].ToString() + "/")
            {
                List <string> list = new List <string>(e.Response.Headers.AllKeys);
                if (ScopeValue == "" && StateValue == "" && NonceValue == "")
                {
                    string location = e.Response.Headers["Location"].ToString();
                    if (!location.Contains("msg=loggedoff"))
                    {
                        string[] words = location.Split('&');

                        //Extracting Scope Value
                        string   Scopeword     = words[4].ToString();
                        string[] ScopeVariable = Scopeword.Split('=');
                        string   correctscope  = ScopeVariable[1].ToString();

                        ScopeValue = correctscope.Replace('+', ' ');

                        //Extracting State Value
                        string   Stateword     = words[5].ToString();
                        string[] stateVariable = Stateword.Split('=');
                        StateValue = stateVariable[1].ToString();

                        //Extracting Nonce Value
                        string   Nonceword     = words[6].ToString();
                        string[] NonceVariable = Nonceword.Split('=');
                        NonceValue = NonceVariable[1].ToString();
                    }
                }
                if (list.Contains("Set-Cookie"))
                {
                    string setcookie = e.Response.Headers["Set-Cookie"].ToString();

                    if (setcookie.Contains("SessionId"))
                    {
                        string[] varcookie   = setcookie.Split(';');
                        string   cookiesplit = string.Empty;
                        if (AssemblyLoad.enviornmentName.Equals("Perf"))
                        {
                            if (threadData.hasFullAccess == "0")
                            {
                                cookiesplit = varcookie[5].ToString();//For Perf Env
                            }
                            else
                            {
                                cookiesplit = varcookie[8].ToString();
                            }
                        }
                        else if (AssemblyLoad.enviornmentName.Equals("RC_Azure"))
                        {
                            if (threadData.hasFullAccess == "0")
                            {
                                cookiesplit = varcookie[0].ToString();//string cookiesplit = varcookie[0].ToString(); //For RC-Azure Env
                            }
                            else
                            {
                                cookiesplit = varcookie[0].ToString();
                            }
                        }

                        string[] cookiesplit1 = cookiesplit.Split('&');

                        string SID   = cookiesplit1[0].ToString();
                        string OrgID = cookiesplit1[1].ToString();

                        //Extracting Session ID value
                        string[] SIDSplit = SID.Split('=');
                        SessionIdValue = SIDSplit[2].ToString();

                        threadData.SessionId = SessionIdValue;

                        //Extracting Organisation ID value
                        string[] OrgIDSplit = OrgID.Split('=');
                        OrgIdValue = OrgIDSplit[1].ToString();

                        threadData.OrganizationId = OrgIdValue;

                        string BNES_SIDCookie = string.Empty;
                        if (AssemblyLoad.enviornmentName.Equals("Perf"))
                        {
                            if (threadData.hasFullAccess == "0")
                            {
                                BNES_SIDCookie = varcookie[14].ToString();//For Perf Env
                            }
                            else
                            {
                                BNES_SIDCookie = varcookie[20].ToString();
                            }

                            string[] BNES_SIDArray = BNES_SIDCookie.Split('=');
                            string   BNES_SID      = BNES_SIDArray[1].ToString() + "=";

                            threadData.BNES_SID = BNES_SID;
                        }
                        else if (AssemblyLoad.enviornmentName.Equals("RC_Azure"))
                        {
                            /*if (threadData.hasFullAccess == "0")
                             *  BNES_SIDCookie = varcookie[0].ToString();//For RC-Azure Env
                             * else
                             *  BNES_SIDCookie = varcookie[3].ToString();
                             *
                             * string[] BNES_SIDArray = BNES_SIDCookie.Split('=');
                             * string BNES_SID = BNES_SIDArray[1].ToString()+"=";
                             *
                             * threadData.BNES_SID = BNES_SID;*/
                        }
                    }
                }
            }

            if (e.Request.Url == e.WebTest.Context["LoginMain"].ToString() + "/auth/authentication/connect/authorize")
            {
                List <string> list = new List <string>(e.Response.Headers.AllKeys);
                if (list.Contains("Location"))
                {
                    string signin = e.Response.Headers["Location"].ToString();
                    if (signin.Contains("signin"))
                    {
                        string[] words    = signin.Split('?');
                        string   wordsign = words[1].ToString();
                        string[] Variable = wordsign.Split('=');
                        SigninValue = Variable[1].ToString();
                    }
                }
            }
            if (e.Request.Url == e.WebTest.Context["AccountingURL"].ToString() + "/pay/default.aspx" && !e.Request.UrlWithQueryString.Contains("?"))
            {
                if (e.Response.BodyString.Contains("tempXml"))
                {
                    List <string> extractedValues = CommonFunctions.GetBetweenList(e.Response.BodyString, "tempXml\" ID=\"tempXml\" VALUE=\"", "\"><BR>");
                    if (e.WebTest.Context.Keys.Contains("tempXmlId"))
                    {
                        e.WebTest.Context["tempXmlId"] = extractedValues.Last();
                    }
                    else
                    {
                        e.WebTest.Context.Add("tempXmlId", extractedValues.Last());
                    }

                    if (e.WebTest.Context.Keys.Contains("hdnRowCount"))
                    {
                        e.WebTest.Context["hdnRowCount"] = CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"hdnRowCount\" VALUE=\"", "\">");
                    }
                    else
                    {
                        e.WebTest.Context.Add("hdnRowCount", CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"hdnRowCount\" VALUE=\"", "\">"));
                    }

                    if (e.WebTest.Context.Keys.Contains("hdnFromForm"))
                    {
                        e.WebTest.Context["hdnFromForm"] = CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"hdnFromForm\" VALUE=\"", "\">");
                    }
                    else
                    {
                        e.WebTest.Context.Add("hdnFromForm", CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"hdnFromForm\" VALUE=\"", "\">"));
                    }

                    if (e.WebTest.Context.Keys.Contains("txtButtonPushedId"))
                    {
                        e.WebTest.Context["txtButtonPushedId"] = CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"txtButtonPushedId\" VALUE=\"", "\">");
                    }
                    else
                    {
                        e.WebTest.Context.Add("txtButtonPushedId", CommonFunctions.GetSingleWordBetween(e.Response.BodyString, "ID=\"txtButtonPushedId\" VALUE=\"", "\">"));
                    }
                }
            }
        }
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.CT_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.CreateTransaction);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_CreateTransaction_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.CreateTransaction + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.CreateTransaction);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.CreateTransaction + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.Login_WebAPI(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.Login_WebAPI(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_CreateTransaction_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_CreateTransaction_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.CreateTransaction + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.CreateTransaction);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.CreateTransaction + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            Thread.Sleep(2000);
            string SessionID = webTest.Context["SessionID"].ToString();
            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            string UserDetailsFromFile    = System.IO.File.ReadAllText("CreateTransactionData.txt");
            string encUserDetailsFromFile = HttpUtility.HtmlEncode(UserDetailsFromFile);

            //Will be used in case need to create both types of transaction
            if (this.GetType().Name == "CreateTransactionXML")
            {
                TransactionStatus = "final";
                Code = "VRK";
            }
            else
            {
                //Selecting Random transaction type
                string[] TTypes = { "final", "temporary" };
                Random   rtemp  = new Random();
                int      index  = rtemp.Next(2);
                string   TType  = TTypes[index];
                TransactionStatus = TType;

                //Selecting Random Code
                string[] codes    = { "INK", "VRK" };
                Random   rInt     = new Random();
                int      r        = rInt.Next(2);
                string   CodeTemp = codes[r];
                Code = CodeTemp;
            }

            //Creating Random Invoice Number
            Random rand            = new Random();
            string CharacterString = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
            string appendName      = new string(Enumerable.Repeat(CharacterString, 4)
                                                .Select(s => s[rand.Next(s.Length)]).ToArray());
            string InvoiceNumber = "SALES-INV-" + appendName;

            //Office fetched from CSV
            string Office = threadData.CompanyName;

            string TranDate = DateTime.Now.ToString("yyyy/MM/MM");
            TranDate = TranDate.Replace("/", "");

            //Replacing the XML file contents to have the dynamic data
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{transactionStatus}", TransactionStatus);
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{Code}", Code);
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{InvoiceNumber}", InvoiceNumber);
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{Office}", Office);
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{TranDate}", TranDate);

            #region CT_ChangeOffice

            webTest.BeginTransaction(WebBTPrefix + "ChangeOffice");
            WebRequestPrefix = "CO_";

            webTest.BeginTransaction(WebRequestPrefix + "webservices_session");
            WebTestRequest request2 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/webservices/session.asmx"));
            request2.Timeout = 60;
            request2.Method  = "POST";
            request2.Headers.Add(new WebTestRequestHeader("Content-Type", "text/xml; charset=utf-8"));
            request2.Headers.Add(new WebTestRequestHeader("SOAPAction", "\"http://www.twinfield.com/SelectCompany\""));
            StringHttpBody request2Body = new StringHttpBody();
            request2Body.ContentType         = "text/xml; charset=utf-8";
            request2Body.InsertByteOrderMark = false;
            request2Body.BodyString          = @"<?xml version=""1.0"" encoding=""utf-8""?><soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Header><Header xmlns=""http://www.twinfield.com/""><SessionID>" + SessionID + @"</SessionID><CompanyId xsi:nil=""true"" /></Header></soap:Header><soap:Body><SelectCompany xmlns=""http://www.twinfield.com/""><company>" + threadData.CompanyName + "</company></SelectCompany></soap:Body></soap:Envelope>";
            request2.Body = request2Body;
            yield return(request2);

            request2 = null;
            webTest.EndTransaction(WebRequestPrefix + "webservices_session");

            webTest.EndTransaction(WebBTPrefix + "ChangeOffice");
            #endregion

            Thread.Sleep(2000);

            #region CT_CreateTransactionXML
            webTest.BeginTransaction(WebBTPrefix + "CreateTransactionXML");
            WebRequestPrefix = "CTX_";

            webTest.BeginTransaction(WebRequestPrefix + "webservices_processxml");
            WebTestRequest request3 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/webservices/processxml.asmx"));
            request3.Timeout = 60;
            request3.Method  = "POST";
            request3.Headers.Add(new WebTestRequestHeader("Content-Type", "text/xml; charset=utf-8"));
            request3.Headers.Add(new WebTestRequestHeader("SOAPAction", "\"http://www.twinfield.com/ProcessXmlString\""));
            StringHttpBody request3Body = new StringHttpBody();
            request3Body.ContentType         = "text/xml; charset=utf-8";
            request3Body.InsertByteOrderMark = false;
            request3Body.BodyString          = @"<?xml version=""1.0"" encoding=""utf-8""?><soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Header><Header xmlns=""http://www.twinfield.com/""><SessionID>" + SessionID + @"</SessionID><CompanyId xsi:nil=""true""/></Header></soap:Header><soap:Body><ProcessXmlString xmlns=""http://www.twinfield.com/""><xmlRequest>" + encUserDetailsFromFile + "</xmlRequest></ProcessXmlString></soap:Body></soap:Envelope>";
            request3.Body = request3Body;
            yield return(request3);

            request3 = null;
            webTest.EndTransaction(WebRequestPrefix + "webservices_processxml");

            webTest.EndTransaction(WebBTPrefix + "CreateTransactionXML");
            #endregion

            Thread.Sleep(2000);

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout_WebAPI(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.EC_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.ExportCustomers);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_ExportCustomers_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ExportCustomers + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.ExportCustomers);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.ExportCustomers + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_ExportCustomers_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_ExportCustomers_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ExportCustomers + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.ExportCustomers);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.ExportCustomers + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            #region EC_GoToSales
            webTest.BeginTransaction(WebBTPrefix + "GoToSales");
            WebRequestPrefix = "GTS_";


            webTest.BeginTransaction(WebRequestPrefix + "en-GB_sales_sales.html");
            WebTestRequest request143 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/sales/sales.html"));
            request143.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request143.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request143);

            request143 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_sales_sales.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_revenuetypes");
            WebTestRequest request144 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/revenuetypes"));
            request144.Method = "OPTIONS";
            request144.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request144.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request144);

            request144 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_revenuetypes");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices");
            WebTestRequest request145 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices"));
            request145.Method = "OPTIONS";
            request145.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request145.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request145);

            request145 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");
            WebTestRequest request146 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-basic-group-tile.html"));
            request146.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request146.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request146);

            request146 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-divider-tile.html");
            WebTestRequest request147 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-divider-tile.html"));
            request147.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request147.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request147);

            request147 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-divider-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");
            WebTestRequest request148 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-dashboard-sub-section-tile.htm" +
                                                            "l"));
            request148.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request148.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request148);

            request148 = null;
            webTest.EndTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers");
            WebTestRequest request149 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers"));
            request149.Method = "OPTIONS";
            request149.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request149.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request149);

            request149 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-insight-tile-view.html");
            WebTestRequest request150 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-insight-tile-view.html"));
            request150.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request150.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request150);

            request150 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-insight-tile-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");
            WebTestRequest request151 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-links-tile.html"));
            request151.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request151.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request151);

            request151 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices_overview");
            WebTestRequest request152 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices/overview"));
            request152.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request152.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request152);

            request152 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices_overview");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices_overview_1");
            WebTestRequest request153 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices/overview"));
            request153.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request153.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request153);

            request153 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices_overview_1");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks");
            WebTestRequest request154 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request154.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request154.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request154);

            request154 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks");

            webTest.EndTransaction(WebBTPrefix + "GoToSales");
            #endregion

            #region EC_GoToCustomers
            webTest.BeginTransaction(WebBTPrefix + "GoToCustomers");
            WebRequestPrefix = "GTC_";

            webTest.BeginTransaction(WebRequestPrefix + "UI");
            WebTestRequest request155 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/UI/"));
            request155.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/UI/#/Sales/Customers");
            yield return(request155);

            request155 = null;
            webTest.EndTransaction(WebRequestPrefix + "UI");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_customers_listing_customers.html");
            WebTestRequest request156 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/customers/listing/customers.html"));
            request156.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request156.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request156);

            request156 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_customers_listing_customers.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks_1");
            WebTestRequest request157 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request157.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request157.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request157);

            request157 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks_1");

            webTest.BeginTransaction(WebRequestPrefix + "activity-title_view_ui-activity-title-view.html");
            WebTestRequest request158 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/activity-title/view/ui-activity-title-view.html"));
            request158.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request158.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request158);

            request158 = null;
            webTest.EndTransaction(WebRequestPrefix + "activity-title_view_ui-activity-title-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_buckets_view_ui-activity-buckets-view.html");
            WebTestRequest request159 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/buckets/view/ui-activity-buckets-view.html"));
            request159.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request159.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request159);

            request159 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_buckets_view_ui-activity-buckets-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_related_view_ui-activity-related-view.html");
            WebTestRequest request160 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/related/view/ui-activity-related-view.html"));
            request160.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request160.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request160);

            request160 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_related_view_ui-activity-related-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers_1");
            WebTestRequest request161 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers"));
            request161.Method = "OPTIONS";
            request161.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request161.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request161);

            request161 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers_1");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB__ui_list_view_ui-list-view.html");
            WebTestRequest request162 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/ui-list-view.html"));
            request162.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request162.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request162);

            request162 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB__ui_list_view_ui-list-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-headers.html");
            WebTestRequest request163 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/flex-columns/ui-list-view-flex-headers.html"));
            request163.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request163.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request163);

            request163 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-headers.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_activity_actions_view_ui-actions-view.html");
            WebTestRequest request164 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/actions/view/ui-actions-view.html"));
            request164.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request164.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request164);

            request164 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_activity_actions_view_ui-actions-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-addnew.html");
            WebTestRequest request165 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-addnew.html"));
            request165.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request165.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request165);

            request165 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-addnew.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-query.html");
            WebTestRequest request166 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-query.html"));
            request166.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request166.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request166);

            request166 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-query.html");

            webTest.BeginTransaction(WebRequestPrefix + "list_view_partials_ui-list-view-navigation.html");
            WebTestRequest request167 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-navigation.html"));
            request167.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request167.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request167);

            request167 = null;
            webTest.EndTransaction(WebRequestPrefix + "list_view_partials_ui-list-view-navigation.html");

            webTest.BeginTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-filters.html");
            WebTestRequest request168 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-filters.html"));
            request168.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request168.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request168);

            request168 = null;
            webTest.EndTransaction(WebRequestPrefix + "ui_list_view_partials_ui-list-view-filters.html");

            webTest.BeginTransaction(WebRequestPrefix + "list_view_partials_ui-list-view-pagination.html");
            WebTestRequest request169 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-pagination.html"));
            request169.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request169.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request169);

            request169 = null;
            webTest.EndTransaction(WebRequestPrefix + "list_view_partials_ui-list-view-pagination.html");

            webTest.BeginTransaction(WebRequestPrefix + "related_view_ui-activity-related-item-view.html");
            WebTestRequest request170 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/related/view/ui-activity-related-item-view.html"));
            request170.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request170.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request170);

            request170 = null;
            webTest.EndTransaction(WebRequestPrefix + "related_view_ui-activity-related-item-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "actions_view_ui-actions-notifications-view.html");
            WebTestRequest request171 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/actions/view/ui-actions-notifications-view.html"));
            request171.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request171.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request171);

            request171 = null;
            webTest.EndTransaction(WebRequestPrefix + "actions_view_ui-actions-notifications-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "view_partials_ui-actions-view-secondaries.html");
            WebTestRequest request172 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/actions/view/partials/ui-actions-view-secondaries.html"));
            request172.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request172.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request172);

            request172 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_partials_ui-actions-view-secondaries.html");

            webTest.BeginTransaction(WebRequestPrefix + "view_partials_ui-actions-view-secondaries-stack");
            WebTestRequest request173 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/actions/view/partials/ui-actions-view-secondaries-stack" +
                                                            "ed.html"));
            request173.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request173.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request173);

            request173 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_partials_ui-actions-view-secondaries-stack");

            webTest.BeginTransaction(WebRequestPrefix + "view_partials_ui-actions-view-laterals.html");
            WebTestRequest request174 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/activity/actions/view/partials/ui-actions-view-laterals.html"));
            request174.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request174.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request174);

            request174 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_partials_ui-actions-view-laterals.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers_2");
            WebTestRequest request175 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers"));
            request175.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request175.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request175.QueryStringParameters.Add("asc", "true", false, false);
            request175.QueryStringParameters.Add("limit", "20", false, false);
            request175.QueryStringParameters.Add("offset", "0", false, false);
            request175.QueryStringParameters.Add("orderBy", "name", false, false);
            yield return(request175);

            request175 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers_2");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers_timeline");
            WebTestRequest request176 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers/timeline"));
            request176.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request176.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request176);

            request176 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers_timeline");

            webTest.BeginTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-record.html");
            WebTestRequest request177 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/flex-columns/ui-list-view-flex-record.html"));
            request177.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request177.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request177);

            request177 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-record.html");

            webTest.BeginTransaction(WebRequestPrefix + "view_partials_ui-list-view-record-actions.html");
            WebTestRequest request178 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/partials/ui-list-view-record-actions.html"));
            request178.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request178.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request178);

            request178 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_partials_ui-list-view-record-actions.html");

            webTest.BeginTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-column.html");
            WebTestRequest request179 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_ui/list/view/flex-columns/ui-list-view-flex-column.html"));
            request179.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request179.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request179);

            request179 = null;
            webTest.EndTransaction(WebRequestPrefix + "view_flex-columns_ui-list-view-flex-column.html");

            webTest.EndTransaction(WebBTPrefix + "GoToCustomers");
            #endregion

            #region EC_ExportToCSV
            webTest.BeginTransaction(WebBTPrefix + "ExportToCSV");

            WebRequestPrefix = "ETE_";

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers_export");
            WebTestRequest request181 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers/export"));
            request181.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request181.QueryStringParameters.Add("fileType", "csv", false, false);
            yield return(request181);

            request181 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers_export");



            webTest.EndTransaction(WebBTPrefix + "ExportToCSV");
            #endregion

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
예제 #8
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.ETBR_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.ExtendedTBReport);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_ExtendedTBReport_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ExtendedTBReport + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.ExtendedTBReport);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.ExtendedTBReport + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_ExtendedTBReport_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_ExtendedTBReport_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ExtendedTBReport + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.ExtendedTBReport);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.ExtendedTBReport + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            #region Report-tab
            webTest.BeginTransaction(WebBTPrefix + "ReportTab");
            WebRequestPrefix = "RT_";

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_reports_reports.html");
            WebTestRequest request135 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/reports/reports.html"));
            request135.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request135.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request135);

            request135 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_reports_reports.html");


            webTest.BeginTransaction(WebRequestPrefix + "api_accessoverview");
            WebTestRequest request136 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/accessoverview"));
            request136.Method = "OPTIONS";
            request136.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request136.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody request136Body = new StringHttpBody();
            request136Body.ContentType         = "";
            request136Body.InsertByteOrderMark = false;
            request136Body.BodyString          = "";
            request136.Body = request136Body;
            yield return(request136);

            request136 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_accessoverview");

            webTest.BeginTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");
            WebTestRequest request137 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-dashboard-sub-section-tile.htm" +
                                                            "l"));
            request137.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request137.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request137);

            request137 = null;
            webTest.EndTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");
            WebTestRequest request138 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-basic-group-tile.html"));
            request138.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request138.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request138);

            request138 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");
            WebTestRequest request139 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-links-tile.html"));
            request139.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request139.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request139);

            request139 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");

            //WebTestRequest request140 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/tasks"));
            //request140.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request140.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //yield return request140;
            //request140 = null;

            webTest.BeginTransaction(WebRequestPrefix + "api_reports");
            WebTestRequest reques148 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/reports"));
            reques148.Method = "OPTIONS";
            reques148.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            reques148.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody reques148Body = new StringHttpBody();
            reques148Body.ContentType         = "";
            reques148Body.InsertByteOrderMark = false;
            reques148Body.BodyString          = "";
            reques148.Body = reques148Body;
            yield return(reques148);

            reques148 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_reports");

            webTest.BeginTransaction(WebRequestPrefix + "api_reports_audittrails");
            WebTestRequest reques149 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/reports/audittrails"));
            reques149.ThinkTime = 1;
            reques149.Method    = "OPTIONS";
            reques149.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            reques149.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody reques149Body = new StringHttpBody();
            reques149Body.ContentType         = "";
            reques149Body.InsertByteOrderMark = false;
            reques149Body.BodyString          = "";
            reques149.Body = reques149Body;
            yield return(reques149);

            reques149 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_reports_audittrails");

            //WebTestRequest request141 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request141.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request141.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request141.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request141;
            //request141 = null;

            webTest.EndTransaction(WebBTPrefix + "ReportTab");

            #endregion
            Thread.Sleep(2000);

            #region report icon
            webTest.BeginTransaction(WebBTPrefix + "ClickOnReportIcon");
            WebRequestPrefix = "RI_";

            //WebTestRequest request142 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/UI/"));
            //request142.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/UI/#/Reports/Categories");
            //yield return request142;
            //request142 = null;

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");
            WebTestRequest request143 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/home/classic/classic.html"));
            request143.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request143.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request143);

            request143 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");

            webTest.BeginTransaction(WebRequestPrefix + "reporting");
            WebTestRequest request144 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/"));
            request144.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request144);

            request144 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting");

            //WebTestRequest request145 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/tasks"));
            //request145.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request145.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //yield return request145;
            //request145 = null;

            //WebTestRequest request146 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request146.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request146.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request146.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request146;
            //request146 = null;
            webTest.EndTransaction(WebBTPrefix + "ClickOnReportIcon");
            #endregion
            Thread.Sleep(2000);

            #region General Ledger click
            webTest.BeginTransaction(WebBTPrefix + "GeneralLedgerClick");
            WebRequestPrefix = "GLC_";

            webTest.BeginTransaction(WebRequestPrefix + "reporting_reportlist.aspx");
            WebTestRequest request147 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/reportlist.aspx"));
            request147.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/")));
            request147.QueryStringParameters.Add("category", "MSC", false, false);  //code for General Ledger report category
            yield return(request147);

            request147 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting_reportlist.aspx");

            //WebTestRequest request148 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request148.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request148.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request148.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request148;
            //request148 = null;

            webTest.EndTransaction(WebBTPrefix + "GeneralLedgerClick");

            #endregion
            Thread.Sleep(2000);

            #region Extended Trial Balance
            webTest.BeginTransaction(WebBTPrefix + "ExtendedTrialBalance");
            WebRequestPrefix = "ETB_";

            //WebTestRequest request149 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request149.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request149.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request149.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request149;
            //request149 = null;

            webTest.BeginTransaction(WebRequestPrefix + "reporting_prompts.aspx");
            WebTestRequest request150 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/prompts.aspx"));
            request150.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/reportlist.aspx?category=MSC")));
            request150.QueryStringParameters.Add("report", "ETB", false, false);
            request150.QueryStringParameters.Add("category", "MSC", false, false);
            request150.QueryStringParameters.Add("reportid", "0", false, false);
            ExtractHiddenFields extractionRule3 = new ExtractHiddenFields();
            extractionRule3.Required             = true;
            extractionRule3.HtmlDecode           = true;
            extractionRule3.ContextParameterName = "1";
            request150.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule3.Extract);
            ExtractText extractionRule2 = new ExtractText();
            extractionRule2.StartsWith           = "name=\"__ncforminfo\" value=\"";
            extractionRule2.EndsWith             = "\"/></FORM>";
            extractionRule2.Index                = 0;
            extractionRule2.IgnoreCase           = false;
            extractionRule2.UseRegularExpression = false;
            extractionRule2.HtmlDecode           = true;
            extractionRule2.Required             = false;
            extractionRule2.ContextParameterName = "NcformInfo";
            request150.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule2.Extract);
            ExtractText extractionRule4 = new ExtractText();
            extractionRule4.StartsWith           = "chkOS_Office_";
            extractionRule4.EndsWith             = "\" ID=\"chkOS_Office";
            extractionRule4.Index                = 0;
            extractionRule4.IgnoreCase           = false;
            extractionRule4.UseRegularExpression = false;
            extractionRule4.HtmlDecode           = true;
            extractionRule4.Required             = false;
            extractionRule4.ContextParameterName = "CompanyName";
            request150.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule4.Extract);
            yield return(request150);

            request150 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting_prompts.aspx");

            webTest.EndTransaction(WebBTPrefix + "ExtendedTrialBalance");
            #endregion
            Thread.Sleep(2000);

            #region Click next
            webTest.BeginTransaction(WebBTPrefix + "ClickNext");
            WebRequestPrefix = "CN_";

            webTest.BeginTransaction(WebRequestPrefix + "reporting_prompts.aspx_1");
            WebTestRequest request152 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/prompts.aspx"));
            request152.Method = "POST";
            request152.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/reporting/report.aspx?category=MSC&report=ETB&reportid=0&tempxml=");
            request152.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/prompts.aspx?report=ETB&category=MSC&reportid=0")));
            request152.QueryStringParameters.Add("category", "MSC", false, false);
            request152.QueryStringParameters.Add("report", "ETB", false, false);
            request152.QueryStringParameters.Add("reportid", "0", false, false);
            FormPostHttpBody request152Body = new FormPostHttpBody();
            request152Body.FormPostParameters.Add("hdnButtonPushed", "view");
            request152Body.FormPostParameters.Add("subreportsDropdown", "0");
            request152Body.FormPostParameters.Add("HierarchyLevel", "");
            request152Body.FormPostParameters.Add("HierarchyLevel_Name", "");
            request152Body.FormPostParameters.Add("HierarchyLevel_HiddenStatus", webTest.Context["$HIDDEN1.HierarchyLevel_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("HierarchyLevel_Levels", "0");
            request152Body.FormPostParameters.Add("radOfficeSelector", "Current");
            request152Body.FormPostParameters.Add("chkOS_Office_" + webTest.Context["CompanyName"].ToString(), "");
            request152Body.FormPostParameters.Add("HierarchyNode", "");
            request152Body.FormPostParameters.Add("HierarchyNode_Name", "");
            request152Body.FormPostParameters.Add("HierarchyNode_HiddenStatus", webTest.Context["$HIDDEN1.HierarchyNode_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("YearPeriod", "2017/00");
            request152Body.FormPostParameters.Add("YearPeriod_Name", "");
            request152Body.FormPostParameters.Add("YearPeriod_HiddenStatus", webTest.Context["$HIDDEN1.YearPeriod_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("YearPeriod_To", "2017/12");
            request152Body.FormPostParameters.Add("YearPeriod_To_Name", "");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_Type_0", "BAS");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_Type_1", "PNL");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType", "");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_Name", "");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_HiddenStatus", webTest.Context["$HIDDEN1.GeneralLedgerAccountType_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_To", "");
            request152Body.FormPostParameters.Add("GeneralLedgerAccountType_To_Name", "");
            request152Body.FormPostParameters.Add("RelationCostCentreType", "");
            request152Body.FormPostParameters.Add("RelationCostCentreType_Name", "");
            request152Body.FormPostParameters.Add("RelationCostCentreType_HiddenStatus", webTest.Context["$HIDDEN1.RelationCostCentreType_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("RelationCostCentreType_To", "");
            request152Body.FormPostParameters.Add("RelationCostCentreType_To_Name", "");
            request152Body.FormPostParameters.Add("ProjectAssetType", "");
            request152Body.FormPostParameters.Add("ProjectAssetType_Name", "");
            request152Body.FormPostParameters.Add("ProjectAssetType_HiddenStatus", webTest.Context["$HIDDEN1.ProjectAssetType_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("ProjectAssetType_To", "");
            request152Body.FormPostParameters.Add("ProjectAssetType_To_Name", "");
            request152Body.FormPostParameters.Add("ActivityType", "");
            request152Body.FormPostParameters.Add("ActivityType_Name", "");
            request152Body.FormPostParameters.Add("ActivityType_HiddenStatus", webTest.Context["$HIDDEN1.ActivityType_HiddenStatus"].ToString());
            request152Body.FormPostParameters.Add("ActivityType_To", "");
            request152Body.FormPostParameters.Add("ActivityType_To_Name", "");
            request152Body.FormPostParameters.Add("SubanalyseOn_locked", webTest.Context["$HIDDEN1.SubanalyseOn_locked"].ToString());
            request152Body.FormPostParameters.Add("TransactionStatus1", "1");
            request152Body.FormPostParameters.Add("TransactionStatus2", "2");
            request152Body.FormPostParameters.Add("Precision", "1");
            request152Body.FormPostParameters.Add("ShowNonAttachedAccounts", "");
            //request152Body.FormPostParameters.Add("__ncforminfo", webTest.Context["NcformInfo"].ToString());
            request152.Body = request152Body;
            ExtractText tempxml = new ExtractText();
            tempxml.StartsWith           = "tempxml=";
            tempxml.EndsWith             = "\"";
            tempxml.Index                = 0;
            tempxml.IgnoreCase           = false;
            tempxml.UseRegularExpression = false;
            tempxml.HtmlDecode           = true;
            tempxml.Required             = false;
            tempxml.ContextParameterName = "tempxml";
            request152.ExtractValues    += new EventHandler <ExtractionEventArgs>(tempxml.Extract);
            yield return(request152);

            request152 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting_prompts.aspx_1");

            //WebTestRequest request153 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request153.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request153.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request153.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request153;
            //request153 = null;

            webTest.EndTransaction(WebBTPrefix + "ClickNext");
            #endregion
            Thread.Sleep(2000);

            #region Export Click
            webTest.BeginTransaction(WebBTPrefix + "ExportClick");
            WebRequestPrefix = "EC_";

            webTest.BeginTransaction(WebRequestPrefix + "reporting_export.aspx");
            WebTestRequest request154 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/export.aspx"));
            request154.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/report.aspx?category=MSC&report=ETB&reportid=0&tempxml=" + webTest.Context["tempxml"].ToString())));
            request154.QueryStringParameters.Add("category", "MSC", false, false);
            request154.QueryStringParameters.Add("report", "ETB", false, false);
            request154.QueryStringParameters.Add("reportid", "0", false, false);
            request154.QueryStringParameters.Add("tempxml", webTest.Context["tempxml"].ToString(), false, false);
            ExtractText extraction2 = new ExtractText();
            extraction2.StartsWith           = "name=\"__ncforminfo\" value=\"";
            extraction2.EndsWith             = "\"/>";
            extraction2.IgnoreCase           = false;
            extraction2.UseRegularExpression = false;
            extraction2.Required             = false;
            extraction2.ExtractRandomMatch   = false;
            extraction2.Index                = 0;
            extraction2.HtmlDecode           = true;
            extraction2.SearchInHeaders      = false;
            extraction2.ContextParameterName = "__ncforminfo";
            request154.ExtractValues        += new EventHandler <ExtractionEventArgs>(extraction2.Extract);

            yield return(request154);

            request154 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting_export.aspx");

            webTest.EndTransaction(WebBTPrefix + "ExportClick");
            #endregion
            Thread.Sleep(2000);

            #region Next on export page
            webTest.BeginTransaction(WebBTPrefix + "ClickNextOnExportPage");
            WebRequestPrefix = "CNOEP_";

            webTest.BeginTransaction(WebRequestPrefix + "reporting_export.aspx_1");
            WebTestRequest request155 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/reporting/export.aspx"));
            request155.Method = "POST";
            request155.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/export.aspx?category=MSC&report=ETB&reportid=0&tempxml=" + webTest.Context["tempxml"].ToString())));
            request155.QueryStringParameters.Add("category", "MSC", false, false);
            request155.QueryStringParameters.Add("report", "ETB", false, false);
            request155.QueryStringParameters.Add("reportid", "0", false, false);
            request155.QueryStringParameters.Add("tempxml", webTest.Context["tempxml"].ToString(), false, false);
            FormPostHttpBody request155Body = new FormPostHttpBody();
            request155Body.FormPostParameters.Add("lstReportTypes", "2");
            request155Body.FormPostParameters.Add("PdfPageBreakAfterGroup", "-1");
            request155Body.FormPostParameters.Add("Orientation", "0");
            request155Body.FormPostParameters.Add("FontSize", "8");
            request155Body.FormPostParameters.Add("FontSize_To", "12");
            request155Body.FormPostParameters.Add("Footer", "");
            request155Body.FormPostParameters.Add("btnExport.x", "Next >");
            //request155Body.FormPostParameters.Add("__ncforminfo", __ncforminfo);
            request155.Body = request155Body;
            yield return(request155);

            request155 = null;
            webTest.EndTransaction(WebRequestPrefix + "reporting_export.aspx_1");

            webTest.EndTransaction(WebBTPrefix + "ClickNextOnExportPage");
            #endregion
            Thread.Sleep(2000);

            #region file manager
            webTest.BeginTransaction(WebBTPrefix + "FileManager");
            WebRequestPrefix = "FM_";

            webTest.BeginTransaction(WebRequestPrefix + "fileman_fileman.aspx");
            WebTestRequest request156 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/fileman/fileman.aspx"));
            request156.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/reporting/export.aspx?category=MSC&report=ETB&reportid=0&tempxml=" + webTest.Context["tempxml"].ToString())));
            yield return(request156);

            request156 = null;
            webTest.EndTransaction(WebRequestPrefix + "fileman_fileman.aspx");

            //WebTestRequest request157 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request157.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request157.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request157.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request157;
            //request157 = null;
            webTest.EndTransaction(WebBTPrefix + "FileManager");
            #endregion
            Thread.Sleep(4000);

            #region Reports click
            webTest.BeginTransaction(WebBTPrefix + "ReportsClick");
            WebRequestPrefix = "RC_";

            webTest.BeginTransaction(WebRequestPrefix + "fileman_fileman.aspx_1");
            WebTestRequest request158 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/fileman/fileman.aspx"));
            request158.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/fileman/fileman.aspx")));
            request158.QueryStringParameters.Add("folder", ".%5cReports", false, false);
            ExtractText extractionRule1 = new ExtractText();
            extractionRule1.StartsWith           = "event,this,'file',";
            extractionRule1.EndsWith             = ",'Extended";
            extractionRule1.Index                = 0;
            extractionRule1.IgnoreCase           = false;
            extractionRule1.UseRegularExpression = false;
            extractionRule1.HtmlDecode           = true;
            extractionRule1.Required             = true;
            extractionRule1.ContextParameterName = "FileID";
            request158.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule1.Extract);
            yield return(request158);

            request158 = null;
            webTest.EndTransaction(WebRequestPrefix + "fileman_fileman.aspx_1");

            //WebTestRequest request159 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request159.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request159.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request159.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request159;
            //request159 = null;

            webTest.EndTransaction(WebBTPrefix + "ReportsClick");
            #endregion
            Thread.Sleep(2000);

            #region  Report download
            webTest.BeginTransaction(WebBTPrefix + "ReportDownload");
            WebRequestPrefix = "RD_";

            webTest.BeginTransaction(WebRequestPrefix + "fileman_download.aspx");
            WebTestRequest request160 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/fileman/download.aspx"));
            request160.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/fileman/fileman.aspx?folder=.%5cReports")));
            request160.QueryStringParameters.Add("fileid", webTest.Context["FileID"].ToString(), false, false);
            yield return(request160);

            request160 = null;
            webTest.EndTransaction(WebRequestPrefix + "fileman_download.aspx");

            //WebTestRequest request161 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request161.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request161.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request161.QueryStringParameters.Add("since", threadData.CreatedDate, false, false);
            //yield return request161;
            //request161 = null;

            webTest.EndTransaction(WebBTPrefix + "ReportDownload");
            #endregion
            Thread.Sleep(2000);

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
예제 #9
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.DM_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.DocumentManagement);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_DocumentManagement_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.DocumentManagement + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.DocumentManagement);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.DocumentManagement + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_DocumentManagement_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_DocumentManagement_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.DocumentManagement + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.DocumentManagement);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.DocumentManagement + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            OfficeManagementID = threadData._textContext["OfficeMgtID"].ToString();
            WebBTPrefix        = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            Thread.Sleep(2000);

            #region DM_GoToVAT
            webTest.BeginTransaction(WebBTPrefix + "GoToVAT");
            WebRequestPrefix = "GTV_";

            webTest.BeginTransaction(WebRequestPrefix + "UI");
            WebTestRequest request181 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/UI/"));
            request181.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/UI/#/Tax");
            yield return(request181);

            request181 = null;
            webTest.EndTransaction(WebRequestPrefix + "UI");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_tax_tax.html");
            WebTestRequest request182 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/tax/tax.html"));
            request182.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request182.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request182);

            request182 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_tax_tax.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");
            WebTestRequest request183 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-basic-group-tile.html"));
            request183.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request183.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request183);

            request183 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");
            WebTestRequest request184 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-dashboard-sub-section-tile.htm" +
                                                            "l"));
            request184.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request184.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request184);

            request184 = null;
            webTest.EndTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");
            WebTestRequest request185 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-links-tile.html"));
            request185.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request185.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request185);

            request185 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks_1");
            WebTestRequest request186 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request186.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request186.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request186);

            request186 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks_1");


            webTest.EndTransaction(WebBTPrefix + "GoToVAT");
            #endregion

            Thread.Sleep(2000);

            #region DM_GoToDocumentManagement
            webTest.BeginTransaction(WebBTPrefix + "GoToDocumentManagement");
            WebRequestPrefix = "GTDM_";

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");
            WebTestRequest request188 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/home/classic/classic.html"));
            request188.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request188.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request188);

            request188 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");

            webTest.BeginTransaction(WebRequestPrefix + "documentmanagement_default.aspx");
            WebTestRequest request189 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx"));
            request189.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            ExtractHiddenFields extractionRule3 = new ExtractHiddenFields();
            extractionRule3.Required             = true;
            extractionRule3.HtmlDecode           = true;
            extractionRule3.ContextParameterName = "1";
            request189.ExtractValues            += new EventHandler <ExtractionEventArgs>(extractionRule3.Extract);
            ExtractText extraction29 = new ExtractText();
            extraction29.StartsWith           = "<INPUT TYPE=\"hidden\" NAME=\"hdnfilters\" ID=\"hdnfilters\" VALUE=\"";
            extraction29.EndsWith             = "\">";
            extraction29.IgnoreCase           = false;
            extraction29.UseRegularExpression = false;
            extraction29.Required             = true;
            extraction29.ExtractRandomMatch   = false;
            extraction29.Index                = 0;
            extraction29.HtmlDecode           = true;
            extraction29.SearchInHeaders      = false;
            extraction29.ContextParameterName = "cor_hdnfilters";
            request189.ExtractValues         += new EventHandler <ExtractionEventArgs>(extraction29.Extract);
            ExtractText extraction30 = new ExtractText();
            extraction30.StartsWith           = "<INPUT TYPE=\"hidden\" NAME=\"hdnfilters\" ID=\"hdnfilters\" VALUE=\"";
            extraction30.EndsWith             = "\">";
            extraction30.IgnoreCase           = false;
            extraction30.UseRegularExpression = false;
            extraction30.Required             = true;
            extraction30.ExtractRandomMatch   = false;
            extraction30.Index                = 0;
            extraction30.HtmlDecode           = true;
            extraction30.SearchInHeaders      = false;
            extraction30.ContextParameterName = "cor_hdnDocument";
            request189.ExtractValues         += new EventHandler <ExtractionEventArgs>(extraction30.Extract);
            ExtractText extraction31 = new ExtractText();
            extraction31.StartsWith           = "<INPUT TYPE=\"hidden\" NAME=\"hdnfilters\" ID=\"hdnfilters\" VALUE=\"";
            extraction31.EndsWith             = "\">";
            extraction31.IgnoreCase           = false;
            extraction31.UseRegularExpression = false;
            extraction31.Required             = true;
            extraction31.ExtractRandomMatch   = false;
            extraction31.Index                = 0;
            extraction31.HtmlDecode           = true;
            extraction31.SearchInHeaders      = false;
            extraction31.ContextParameterName = "cor_hdnDocuments";
            request189.ExtractValues         += new EventHandler <ExtractionEventArgs>(extraction31.Extract);
            ExtractText extraction32 = new ExtractText();
            extraction32.StartsWith           = "<INPUT TYPE=\"hidden\" NAME=\"hdnfilters\" ID=\"hdnfilters\" VALUE=\"";
            extraction32.EndsWith             = "\">";
            extraction32.IgnoreCase           = false;
            extraction32.UseRegularExpression = false;
            extraction32.Required             = true;
            extraction32.ExtractRandomMatch   = false;
            extraction32.Index                = 0;
            extraction32.HtmlDecode           = true;
            extraction32.SearchInHeaders      = false;
            extraction32.ContextParameterName = "cor_hdnUpdatedTransitions";
            request189.ExtractValues         += new EventHandler <ExtractionEventArgs>(extraction32.Extract);
            yield return(request189);

            request189 = null;
            webTest.EndTransaction(WebRequestPrefix + "documentmanagement_default.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks_2");
            WebTestRequest request190 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request190.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request190.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request190);

            request190 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks_2");


            webTest.EndTransaction(WebBTPrefix + "GoToDocumentManagement");
            #endregion

            Thread.Sleep(2000);

            #region DM_ClickResetFilters
            webTest.BeginTransaction(WebBTPrefix + "ClickResetFilters");
            WebRequestPrefix = "CRF_";

            webTest.BeginTransaction(WebRequestPrefix + "documentmanagement_default.aspx_1");
            WebTestRequest request192 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx"));
            request192.Method = "POST";
            FormPostHttpBody request192Body = new FormPostHttpBody();
            request192Body.FormPostParameters.Add("hdnSelectedDocuments", "[]");
            request192Body.FormPostParameters.Add("hdnfilters", webTest.Context["cor_hdnfilters"].ToString());
            request192Body.FormPostParameters.Add("hdnDocument", webTest.Context["cor_hdnDocument"].ToString());
            request192Body.FormPostParameters.Add("hdnDocuments", webTest.Context["cor_hdnDocuments"].ToString());
            request192Body.FormPostParameters.Add("hdnUpdatedTransitions", webTest.Context["cor_hdnUpdatedTransitions"].ToString());
            request192.Body = request192Body;
            //WebTestRequest request192Dependent1 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx"));
            //request192Dependent1.Method = "POST";
            //request192Dependent1.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx")));
            //FormPostHttpBody request192Dependent1Body = new FormPostHttpBody();
            //request192Dependent1Body.FormPostParameters.Add("hdnSelectedDocuments", "[]");
            //request192Dependent1Body.FormPostParameters.Add("hdnfilters", webTest.Context["$HIDDEN1.hdnfilters"].ToString());
            //request192Dependent1Body.FormPostParameters.Add("hdnDocument", webTest.Context["$HIDDEN1.hdnDocument"].ToString());
            //request192Dependent1Body.FormPostParameters.Add("hdnDocuments", webTest.Context["$HIDDEN1.hdnDocuments"].ToString());
            //request192Dependent1Body.FormPostParameters.Add("hdnUpdatedTransitions", webTest.Context["$HIDDEN1.hdnUpdatedTransitions"].ToString());
            //request192Dependent1.Body = request192Dependent1Body;
            //request192.DependentRequests.Add(request192Dependent1);
            ExtractText extraction2 = new ExtractText();
            extraction2.StartsWith           = "{\"sSearch\":\"";
            extraction2.EndsWith             = "\"},\"oLanguage\"";
            extraction2.IgnoreCase           = false;
            extraction2.UseRegularExpression = false;
            extraction2.Required             = true;
            extraction2.ExtractRandomMatch   = false;
            extraction2.Index                = 0;
            extraction2.HtmlDecode           = true;
            extraction2.SearchInHeaders      = false;
            extraction2.ContextParameterName = "cor_sSearch";
            request192.ExtractValues        += new EventHandler <ExtractionEventArgs>(extraction2.Extract);
            ExtractText extraction23 = new ExtractText();
            extraction23.StartsWith           = "'; availableTransitions = ";
            extraction23.EndsWith             = ";";
            extraction23.IgnoreCase           = false;
            extraction23.UseRegularExpression = false;
            extraction23.Required             = true;
            extraction23.ExtractRandomMatch   = false;
            extraction23.Index                = 0;
            extraction23.HtmlDecode           = true;
            extraction23.SearchInHeaders      = false;
            extraction23.ContextParameterName = "cor_AVLTransitions";
            request192.ExtractValues         += new EventHandler <ExtractionEventArgs>(extraction23.Extract);
            yield return(request192);

            request192 = null;
            webTest.EndTransaction(WebRequestPrefix + "documentmanagement_default.aspx_1");

            webTest.EndTransaction(WebBTPrefix + "ClickResetFilters");
            #endregion

            Thread.Sleep(2000);

            #region DM_ClickCheckStatus01
            webTest.BeginTransaction(WebBTPrefix + "ClickCheckStatus01");
            WebRequestPrefix = "CCS1_";

            webTest.BeginTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx");
            WebTestRequest request194 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/documentsdata.aspx"));
            request194.Method = "POST";
            request194.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx")));
            FormPostHttpBody request194Body = new FormPostHttpBody();
            request194Body.FormPostParameters.Add("requestType", "checkStatus");
            request194.Body = request194Body;
            yield return(request194);

            request194 = null;
            webTest.EndTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx");


            webTest.EndTransaction(WebBTPrefix + "ClickCheckStatus01");
            #endregion

            Thread.Sleep(2000);

            string        str           = webTest.Context["cor_sSearch"].ToString().Replace("\\\"", "\"");
            List <Class1> ssearchobject = JsonConvert.DeserializeObject <List <Class1> >(str);

            ssearchobject.Where(w => w.name == "year").Select(w => w.options.Random()._checked = true).ToList();

            string sSearchBodyString = JsonConvert.SerializeObject(ssearchobject);
            sSearchBodyString = sSearchBodyString.Replace("_checked", "checked");

            #region DM_AddFilter
            webTest.BeginTransaction(WebBTPrefix + "AddFilter");
            WebRequestPrefix = "AF_";

            webTest.BeginTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx_1");
            WebTestRequest request196 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/documentsdata.aspx"));
            request196.Method = "POST";
            request196.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/javascript, */*; q=0.01"));
            request196.Headers.Add(new WebTestRequestHeader("X-Requested-With", "XMLHttpRequest"));
            request196.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx")));
            FormPostHttpBody request196Body = new FormPostHttpBody();
            request196Body.FormPostParameters.Add("sEcho", "2");
            request196Body.FormPostParameters.Add("iColumns", "14");
            request196Body.FormPostParameters.Add("sColumns", "checkbox,delete,name,type,office,period,status,assignee,actions,id,workflowId,transitions,extrainfo,exclamation");
            request196Body.FormPostParameters.Add("iDisplayStart", "0");
            request196Body.FormPostParameters.Add("iDisplayLength", "100");
            request196Body.FormPostParameters.Add("mDataProp_0", "0");
            request196Body.FormPostParameters.Add("mDataProp_1", "1");
            request196Body.FormPostParameters.Add("mDataProp_2", "2");
            request196Body.FormPostParameters.Add("mDataProp_3", "3");
            request196Body.FormPostParameters.Add("mDataProp_4", "4");
            request196Body.FormPostParameters.Add("mDataProp_5", "5");
            request196Body.FormPostParameters.Add("mDataProp_6", "6");
            request196Body.FormPostParameters.Add("mDataProp_7", "7");
            request196Body.FormPostParameters.Add("mDataProp_8", "8");
            request196Body.FormPostParameters.Add("mDataProp_9", "9");
            request196Body.FormPostParameters.Add("mDataProp_10", "10");
            request196Body.FormPostParameters.Add("mDataProp_11", "11");
            request196Body.FormPostParameters.Add("mDataProp_12", "12");
            request196Body.FormPostParameters.Add("mDataProp_13", "13");
            request196Body.FormPostParameters.Add("sSearch", sSearchBodyString, true);// webTest.Context["cor_sSearch"].ToString(),true);
            request196Body.FormPostParameters.Add("bRegex", "false");
            request196Body.FormPostParameters.Add("sSearch_0", "");
            request196Body.FormPostParameters.Add("bRegex_0", "false");
            request196Body.FormPostParameters.Add("bSearchable_0", "true");
            request196Body.FormPostParameters.Add("sSearch_1", "");
            request196Body.FormPostParameters.Add("bRegex_1", "false");
            request196Body.FormPostParameters.Add("bSearchable_1", "true");
            request196Body.FormPostParameters.Add("sSearch_2", "");
            request196Body.FormPostParameters.Add("bRegex_2", "false");
            request196Body.FormPostParameters.Add("bSearchable_2", "true");
            request196Body.FormPostParameters.Add("sSearch_3", "");
            request196Body.FormPostParameters.Add("bRegex_3", "false");
            request196Body.FormPostParameters.Add("bSearchable_3", "true");
            request196Body.FormPostParameters.Add("sSearch_4", "");
            request196Body.FormPostParameters.Add("bRegex_4", "false");
            request196Body.FormPostParameters.Add("bSearchable_4", "true");
            request196Body.FormPostParameters.Add("sSearch_5", "");
            request196Body.FormPostParameters.Add("bRegex_5", "false");
            request196Body.FormPostParameters.Add("bSearchable_5", "true");
            request196Body.FormPostParameters.Add("sSearch_6", "");
            request196Body.FormPostParameters.Add("bRegex_6", "false");
            request196Body.FormPostParameters.Add("bSearchable_6", "true");
            request196Body.FormPostParameters.Add("sSearch_7", "");
            request196Body.FormPostParameters.Add("bRegex_7", "false");
            request196Body.FormPostParameters.Add("bSearchable_7", "true");
            request196Body.FormPostParameters.Add("sSearch_8", "");
            request196Body.FormPostParameters.Add("bRegex_8", "false");
            request196Body.FormPostParameters.Add("bSearchable_8", "true");
            request196Body.FormPostParameters.Add("sSearch_9", "");
            request196Body.FormPostParameters.Add("bRegex_9", "false");
            request196Body.FormPostParameters.Add("bSearchable_9", "true");
            request196Body.FormPostParameters.Add("sSearch_10", "");
            request196Body.FormPostParameters.Add("bRegex_10", "false");
            request196Body.FormPostParameters.Add("bSearchable_10", "true");
            request196Body.FormPostParameters.Add("sSearch_11", "");
            request196Body.FormPostParameters.Add("bRegex_11", "false");
            request196Body.FormPostParameters.Add("bSearchable_11", "true");
            request196Body.FormPostParameters.Add("sSearch_12", "");
            request196Body.FormPostParameters.Add("bRegex_12", "false");
            request196Body.FormPostParameters.Add("bSearchable_12", "true");
            request196Body.FormPostParameters.Add("sSearch_13", "");
            request196Body.FormPostParameters.Add("bRegex_13", "false");
            request196Body.FormPostParameters.Add("bSearchable_13", "true");
            request196Body.FormPostParameters.Add("iSortingCols", "0");
            request196Body.FormPostParameters.Add("bSortable_0", "false");
            request196Body.FormPostParameters.Add("bSortable_1", "false");
            request196Body.FormPostParameters.Add("bSortable_2", "false");
            request196Body.FormPostParameters.Add("bSortable_3", "true");
            request196Body.FormPostParameters.Add("bSortable_4", "true");
            request196Body.FormPostParameters.Add("bSortable_5", "true");
            request196Body.FormPostParameters.Add("bSortable_6", "true");
            request196Body.FormPostParameters.Add("bSortable_7", "true");
            request196Body.FormPostParameters.Add("bSortable_8", "false");
            request196Body.FormPostParameters.Add("bSortable_9", "false");
            request196Body.FormPostParameters.Add("bSortable_10", "false");
            request196Body.FormPostParameters.Add("bSortable_11", "false");
            request196Body.FormPostParameters.Add("bSortable_12", "false");
            request196Body.FormPostParameters.Add("bSortable_13", "false");
            request196Body.FormPostParameters.Add("filterChanged", "year");
            request196Body.FormPostParameters.Add("pageCulture", "en-GB");
            request196Body.FormPostParameters.Add("selectedDocumentIds", "[]");
            request196Body.FormPostParameters.Add("availableTransitions", webTest.Context["cor_AVLTransitions"].ToString());
            request196.Body = request196Body;
            yield return(request196);

            request196 = null;
            webTest.EndTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx_1");

            webTest.EndTransaction(WebBTPrefix + "AddFilter");
            #endregion

            Thread.Sleep(2000);

            #region DM_ClickCheckStatus02
            webTest.BeginTransaction(WebBTPrefix + "ClickCheckStatus02");
            WebRequestPrefix = "CCS2_";

            webTest.BeginTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx_2");
            WebTestRequest request197 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/documentmanagement/documentsdata.aspx"));
            request197.Method = "POST";
            request197.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/documentmanagement/default.aspx")));
            FormPostHttpBody request197Body = new FormPostHttpBody();
            request197Body.FormPostParameters.Add("requestType", "checkStatus");
            request197.Body = request197Body;
            yield return(request197);

            request197 = null;
            webTest.EndTransaction(WebRequestPrefix + "documentmanagement_documentsdata.aspx_2");

            webTest.EndTransaction(WebBTPrefix + "ClickCheckStatus02");
            #endregion

            Thread.Sleep(2000);

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
 /// <summary>
 /// Let listener thread know that it should wind down and stop listening for incoming
 /// HTTP requests.
 /// </summary>
 /// <param name="threadData">
 /// Object containing shared data used to communicate with listener thread.
 /// </param>
 private static void SendStopMessage(SharedThreadData threadData)
 {
     if (threadData.StateManager != null)
     {
         // If there's already a state manager associated with the server thread,
         // tell it to stop listening.
         threadData.StateManager.Stop();
     }
     
     // Even if there's no dispatcher associated with the server thread yet,
     // let thread know that it should bail out immediately after starting
     // up, and never push a dispatcher frame at all.
     threadData.StopRequestSent = true;
 }
        /// <summary>
        /// Start listening for requests.
        /// </summary>
        public void Start()
        {
            lock (this.lockObject)
            {
                Thread oldThread = null;

                // If thread is currently running
                if (this.IsListening)
                {
                    if (!this.threadData.StopRequestSent)
                    {
                        // Thread is already running and ready to handle requests, so there
                        // is no need to start up a new one.
                        return;
                    }

                    // If thread is running, but still in the process of winding down,
                    // dissociate server from currently running thread without waiting for
                    // thread to finish.
                    // New thread will wait for previous thread to finish so that there is
                    // no conflict between two different threads listening on the same URI
                    // prefixes.
                    oldThread = this.threadData.Thread;
                    this.threadData = null;
                }

                this.threadData = new SharedThreadData
                {
                    Thread = new Thread(this.ListenerThread),
                    PreviousThread = oldThread
                };
                this.threadData.Thread.Start(this.threadData);
            }
        }
예제 #12
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.RT_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.ReadTransaction);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_ReadTransaction_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ReadTransaction + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.ReadTransaction);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.ReadTransaction + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.Login_WebAPI(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.Login_WebAPI(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_ReadTransaction_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_ReadTransaction_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ReadTransaction + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.ReadTransaction);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.ReadTransaction + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            string SessionID              = webTest.Context["SessionID"].ToString();
            string UserDetailsFromFile    = System.IO.File.ReadAllText("ReadTransactionData.txt");
            string encUserDetailsFromFile = HttpUtility.HtmlEncode(UserDetailsFromFile);
            string FromDate = DateTime.Now.AddYears(-5).ToString("yyyy/MM");
            string ToDate   = DateTime.Now.ToString("yyyy/MM");
            //Replacing the XML file contents to have the dynamic data
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{FromDate}", FromDate);
            encUserDetailsFromFile = encUserDetailsFromFile.Replace("{ToDate}", ToDate);

            string ReadData = @"<?xml version=""1.0"" encoding=""utf-8""?><soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Header><Header xmlns=""http://www.twinfield.com/""><SessionID>" + SessionID + @"</SessionID><CompanyId xsi:nil=""true"" /></Header></soap:Header><soap:Body><ProcessXmlString xmlns=""http://www.twinfield.com/""><xmlRequest>" + encUserDetailsFromFile + "</xmlRequest></ProcessXmlString></soap:Body></soap:Envelope>";

            Thread.Sleep(2000);

            #region RT_ReadTransactionXML
            webTest.BeginTransaction(WebBTPrefix + "RT_ReadTransactionXML");
            WebRequestPrefix = "RTX_";

            webTest.BeginTransaction(WebRequestPrefix + "webservices_processxml");
            WebTestRequest request2 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/webservices/processxml.asmx"));
            request2.Timeout = 60;
            request2.Method  = "POST";
            request2.Headers.Add(new WebTestRequestHeader("Content-Type", "text/xml; charset=utf-8"));
            request2.Headers.Add(new WebTestRequestHeader("SOAPAction", "\"http://www.twinfield.com/ProcessXmlString\""));
            StringHttpBody request2Body = new StringHttpBody();
            request2Body.ContentType         = "text/xml; charset=utf-8";
            request2Body.InsertByteOrderMark = false;
            request2Body.BodyString          = ReadData;
            #region BodySTring
            //"<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.x" +
            //		"mlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Header><Header xmlns=\"http:/" +
            //		"/www.twinfield.com/\"><SessionID>" + SessionID + "</SessionID>" +
            //		"<CompanyId xsi:nil=\"true\" /></Header></soap:Header><soap:Body><ProcessXmlString" +
            //		"xmlns=\"http://www.twinfield.com/\"><xmlRequest>&lt;columns code=\"020\"&gt;\n&" +
            //		"lt;column id=\"1\"&gt;\n&lt;field&gt;fin.trs.head.yearperiod&lt;/field&gt;" +
            //		"\n&lt;label&gt;Period&lt;/label&gt;\n&lt;visible&gt;true&lt;/vis" +
            //		"ible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&lt;operator&gt;between&l" +
            //		"t;/operator&gt;\n&lt;from&gt;2001/01&lt;/from&gt;\n&lt;to&gt;201" +
            //		"8/08&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n&lt;/colu" +
            //		"mn&gt;\n&lt;column id=\"2\"&gt;\n&lt;field&gt;fin.trs.head.code&lt;/f" +
            //		"ield&gt;\n&lt;label&gt;Transaction type&lt;/label&gt;\n&lt;visib" +
            //		"le&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&lt;ope" +
            //		"rator&gt;equal&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n&lt;" +
            //		"to&gt;&lt;/to&gt;\n&lt;finderparam&gt;hidden=1&lt;/finderparam&gt;\n" +
            //		"&lt;/column&gt;\n&lt;column id=\"3\"&gt;\n&lt;field&gt;fin.trs.head." +
            //		"shortname&lt;/field&gt;\n&lt;label&gt;Name&lt;/label&gt;\n&lt;vi" +
            //		"sible&gt;true&lt;/visible&gt;\n&lt;ask&gt;false&lt;/ask&gt;\n&lt" +
            //		";operator&gt;none&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n&" +
            //		"lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n&lt;" +
            //		"/column&gt;\n&lt;column id=\"4\"&gt;\n&lt;field&gt;fin.trs.head.numbe" +
            //		"r&lt;/field&gt;\n&lt;label&gt;Trans. no.&lt;/label&gt;\n&lt;visi" +
            //		"ble&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&lt;op" +
            //		"erator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n&" +
            //		"lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n&lt;" +
            //		"/column&gt;\n&lt;column id=\"5\"&gt;\n&lt;field&gt;fin.trs.head.statu" +
            //		"s&lt;/field&gt;\n&lt;label&gt;Status&lt;/label&gt;\n&lt;visible&" +
            //		"gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&lt;operat" +
            //		"or&gt;equal&lt;/operator&gt;\n&lt;from&gt;normal&lt;/from&gt;\n&" +
            //		"lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n&lt;" +
            //		"/column&gt;\n&lt;column id=\"6\"&gt;\n&lt;field&gt;fin.trs.head.date&" +
            //		"lt;/field&gt;\n&lt;label&gt;Trans.date&lt;/label&gt;\n&lt;visib" +
            //		"le&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&lt;ope" +
            //		"rator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n&l" +
            //		"t;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n&lt;/" +
            //		"column&gt;\n&lt;column id=\"7\"&gt;\n&lt;field&gt;fin.trs.head.inpdat" +
            //		"e&lt;/field&gt;\n&lt;label&gt;Date of entry&lt;/label&gt;\n&lt;v" +
            //		"isible&gt;false&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n&l" +
            //		"t;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n" +
            //		"&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n" +
            //		"&lt;/column&gt;\n&lt;column id=\"8\"&gt;\n&lt;field&gt;fin.trs.head.m" +
            //		"odified&lt;/field&gt;\n&lt;label&gt;Modification date&lt;/label&gt;\n" +
            //		"&lt;visible&gt;false&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n" +
            //		"&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&" +
            //		"gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&" +
            //		"gt;\n&lt;/column&gt;\n&lt;column id=\"9\"&gt;\n&lt;field&gt;fin." +
            //		"trs.line.dim1&lt;/field&gt;\n&lt;label&gt;General ledger&lt;/label&gt;\n" +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;" +
            //		"\n&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/fro" +
            //		"m&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderpara" +
            //		"m&gt;\n&lt;/column&gt;\n&lt;column id=\"10\"&gt;\n&lt;field&gt;f" +
            //		"in.trs.line.dim2&lt;/field&gt;\n&lt;label&gt;Cust./supp.&lt;/label&gt;\n " +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;" +
            //		"\n&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/fro" +
            //		"m&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderpara" +
            //		"m&gt;\n&lt;/column&gt;\n&lt;column id=\"11\"&gt;\n&lt;field&gt;f" +
            //		"in.trs.line.dim3&lt;/field&gt;\n&lt;label&gt;Project&lt;/label&gt;\n" +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n" +
            //		"&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt" +
            //		";\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt" +
            //		";\n&lt;/column&gt;\n&lt;column id=\"12\"&gt;\n&lt;field&gt;fin.t" +
            //		"rs.head.curcode&lt;/field&gt;\n&lt;label&gt;Currency&lt;/label&gt;\n     " +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n   " +
            //		"&lt;operator&gt;equal&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;\n" +
            //		"&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;\n" +
            //		"&lt;/column&gt;\n&lt;column id=\"13\"&gt;\n&lt;field&gt;fin.trs" +
            //		".line.valuesigned&lt;/field&gt;\n&lt;label&gt;Value&lt;/label&gt;\n" +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n" +
            //		"&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;" +
            //		"\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;" +
            //		"\n&lt;/column&gt;\n&lt;column id=\"14\"&gt;\n&lt;field&gt;fin.tr" +
            //		"s.line.basevaluesigned&lt;/field&gt;\n&lt;label&gt;Euro&lt;/label&gt;\n" +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n" +
            //		"&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/from" +
            //		"&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam" +
            //		"&gt;\n&lt;/column&gt;\n&lt;column id=\"15\"&gt;\n&lt;field&gt;fi" +
            //		"n.trs.line.repvaluesigned&lt;/field&gt;\n&lt;label&gt;&lt;/label&gt;\n   " +
            //		"&lt;visible&gt;false&lt;/visible&gt;\n&lt;ask&gt;false&lt;/ask&gt;" +
            //		"\n&lt;operator&gt;between&lt;/operator&gt;\n&lt;from&gt;&lt;/fro" +
            //		"m&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderpara" +
            //		"m&gt;\n&lt;/column&gt;\n&lt;column id=\"16\"&gt;\n&lt;field&gt;f" +
            //		"in.trs.line.invnumber&lt;/field&gt;\n&lt;label&gt;Invoice no.&lt;/label&" +
            //		"gt;\n&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/as" +
            //		"k&gt;\n&lt;operator&gt;equal&lt;/operator&gt;\n&lt;from&gt;&lt;/" +
            //		"from&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderp" +
            //		"aram&gt;\n&lt;/column&gt;\n&lt;column id=\"17\"&gt;\n&lt;field&g" +
            //		"t;fin.trs.head.user&lt;/field&gt;\n&lt;label&gt;User&lt;/label&gt;\n" +
            //		"&lt;visible&gt;false&lt;/visible&gt;\n&lt;ask&gt;true&lt;/ask&gt;\n  " +
            //		"&lt;operator&gt;equal&lt;/operator&gt;\n&lt;from&gt;&lt;/from&gt;" +
            //		"\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&gt;" +
            //		"\n&lt;/column&gt;\n&lt;column id=\"18\"&gt;\n&lt;field&gt;fin.tr" +
            //		"s.head.inpdate&lt;/field&gt;\n&lt;label&gt;Date of entry&lt;/label&gt;\n " +
            //		"&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;false&lt;/ask&gt" +
            //		";\n&lt;operator&gt;none&lt;/operator&gt;\n&lt;from&gt;&lt;/from&" +
            //		"gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderparam&" +
            //		"gt;\n&lt;/column&gt;\n&lt;column id=\"19\"&gt;\n&lt;field&gt;fin" +
            //		".trs.line.description&lt;/field&gt;\n&lt;label&gt;Description&lt;/label&" +
            //		"gt;\n&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;false&lt;/a" +
            //		"sk&gt;\n&lt;operator&gt;none&lt;/operator&gt;\n&lt;from&gt;&lt;/" +
            //		"from&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finderp" +
            //		"aram&gt;\n&lt;/column&gt;\n&lt;column id=\"20\"&gt;\n&lt;field&g" +
            //		"t;fin.trs.head.browseregime&lt;/field&gt;\n&lt;label&gt;Regime&lt;/label" +
            //		"&gt;\n&lt;visible&gt;true&lt;/visible&gt;\n&lt;ask&gt;true&lt;/a" +
            //		"sk&gt;\n&lt;operator&gt;equal&lt;/operator&gt;\n&lt;from&gt;&lt;" +
            //		"/from&gt;\n&lt;to&gt;&lt;/to&gt;\n&lt;finderparam&gt;&lt;/finder" +
            //		"param&gt;\n&lt;/column&gt;\n&lt;/columns&gt;</xmlRequest></ProcessXmlStri" +
            //		"ng></soap:Body></soap:Envelope>";
            #endregion
            request2.Body = request2Body;
            yield return(request2);

            request2 = null;


            webTest.EndTransaction(WebRequestPrefix + "webservices_processxml");

            webTest.EndTransaction(WebBTPrefix + "RT_ReadTransactionXML");
            #endregion

            Thread.Sleep(2000);

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout_WebAPI(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }
예제 #13
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.PCR_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.PayAndCollectRun);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_PayAndCollectRun_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.PayAndCollectRun + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.PayAndCollectRun);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.PayAndCollectRun + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_PayAndCollectRun_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_PayAndCollectRun_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.PayAndCollectRun + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.PayAndCollectRun);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.PayAndCollectRun + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";

            Thread.Sleep(2000);

            #region ClickOn_SalesTab
            webTest.BeginTransaction(WebBTPrefix + "ClickOn_SalesTab");
            WebRequestPrefix = "ST_";

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications");
            WebTestRequest request184 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request184.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request184.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request184.QueryStringParameters.Add("since", "2018-09-04T08:53:57.990Z", false, false);
            yield return(request184);

            request184 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_sales_sales.html");
            WebTestRequest request185 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/sales/sales.html"));
            request185.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request185.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request185);

            request185 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_sales_sales.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_revenuetypes");
            WebTestRequest request186 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/revenuetypes"));
            request186.Method = "OPTIONS";
            request186.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request186.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody request186Body = new StringHttpBody();
            request186Body.ContentType         = "";
            request186Body.InsertByteOrderMark = false;
            request186Body.BodyString          = "";
            request186.Body = request186Body;
            yield return(request186);

            request186 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_revenuetypes");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices");
            WebTestRequest request187 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices"));
            request187.Method = "OPTIONS";
            request187.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request187.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody request187Body = new StringHttpBody();
            request187Body.ContentType         = "";
            request187Body.InsertByteOrderMark = false;
            request187Body.BodyString          = "";
            request187.Body = request187Body;
            yield return(request187);

            request187 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");
            WebTestRequest request188 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-basic-group-tile.html"));
            request188.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request188.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request188);

            request188 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-basic-group-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-divider-tile.html");
            WebTestRequest request189 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-divider-tile.html"));
            request189.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request189.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request189);

            request189 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-divider-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");
            WebTestRequest request190 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-dashboard-sub-section-tile.htm" +
                                                            "l"));
            request190.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request190.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request190);

            request190 = null;
            webTest.EndTransaction(WebRequestPrefix + "desktop_view_cr-dashboard-sub-section-tile.htm");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_customers");
            WebTestRequest request191 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/customers"));
            request191.Method = "OPTIONS";
            request191.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request191.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            StringHttpBody request191Body = new StringHttpBody();
            request191Body.ContentType         = "";
            request191Body.InsertByteOrderMark = false;
            request191Body.BodyString          = "";
            request191.Body = request191Body;
            yield return(request191);

            request191 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_customers");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-insight-tile-view.html");
            WebTestRequest request192 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-insight-tile-view.html"));
            request192.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request192.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request192);

            request192 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-insight-tile-view.html");

            webTest.BeginTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");
            WebTestRequest request193 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/_components/framework/desktop/view/cr-links-tile.html"));
            request193.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request193.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request193);

            request193 = null;
            webTest.EndTransaction(WebRequestPrefix + "framework_desktop_view_cr-links-tile.html");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices_overview");
            WebTestRequest request194 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices/overview"));
            request194.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request194.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request194);

            request194 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices_overview");

            webTest.BeginTransaction(WebRequestPrefix + "api_sales_invoices_overview_1");
            WebTestRequest request195 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/sales/invoices/overview"));
            request195.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request195.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request195);

            request195 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_sales_invoices_overview_1");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks");
            WebTestRequest request196 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request196.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request196.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request196);

            request196 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks");

            webTest.EndTransaction(WebBTPrefix + "ClickOn_SalesTab");

            #endregion

            Thread.Sleep(2000);

            #region Click_PayAndCollect
            webTest.BeginTransaction(WebBTPrefix + "Click_PayAndCollect");
            WebRequestPrefix = "PAC_";

            webTest.BeginTransaction(WebRequestPrefix + "UI");
            WebTestRequest request197 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/UI/"));
            request197.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/UI/#/Sales/PayAndCollect");
            yield return(request197);

            request197 = null;
            webTest.EndTransaction(WebRequestPrefix + "UI");

            webTest.BeginTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");
            WebTestRequest request198 = new WebTestRequest((webTest.Context["TwfcndURL"].ToString() + "/" + threadData.BuildVersion + "/en-GB/home/classic/classic.html"));
            request198.Headers.Add(new WebTestRequestHeader("Accept", "application/json, text/plain, */*;version=latest"));
            request198.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request198);

            request198 = null;
            webTest.EndTransaction(WebRequestPrefix + "en-GB_home_classic_classic.html");

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx");
            WebTestRequest request199 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            request199.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request199.QueryStringParameters.Add("paytype", "pay", false, false);
            yield return(request199);

            request199 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_tasks_1");
            WebTestRequest request200 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/tasks"));
            request200.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request200.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            yield return(request200);

            request200 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_tasks_1");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_1");
            WebTestRequest request201 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request201.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request201.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request201.QueryStringParameters.Add("since", "2018-09-04T08:53:57.990Z", false, false);
            yield return(request201);

            request201 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_1");

            webTest.EndTransaction(WebBTPrefix + "Click_PayAndCollect");
            #endregion

            Thread.Sleep(2000);

            #region ClickNew_OnPayAndCollect
            webTest.BeginTransaction(WebBTPrefix + "ClickNew_OnPayAndCollect");
            WebRequestPrefix = "New_";

            webTest.BeginTransaction(WebRequestPrefix + "desktop_navigate.aspx");
            WebTestRequest request202 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/desktop/navigate.aspx"));
            request202.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx?paytype=pay")));
            request202.QueryStringParameters.Add("treebase", "%23PAY%3a", false, false);
            yield return(request202);

            request202 = null;
            webTest.EndTransaction(WebRequestPrefix + "desktop_navigate.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_2");
            WebTestRequest request203 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request203.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request203.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request203.QueryStringParameters.Add("since", "2018-09-04T08:53:57.990Z", false, false);
            yield return(request203);

            request203 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_2");

            webTest.EndTransaction(WebBTPrefix + "ClickNew_OnPayAndCollect");
            #endregion

            Thread.Sleep(2000);

            #region Click_SEPAIncasso
            webTest.BeginTransaction(WebBTPrefix + "Click_SEPAIncasso");
            WebRequestPrefix = "SI_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_paylist.aspx");
            WebTestRequest request204 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/paylist.aspx"));
            request204.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/desktop/navigate.aspx?treebase=%23PAY%3a")));
            request204.QueryStringParameters.Add("treebase", "%23PAY%3a", false, false);
            request204.QueryStringParameters.Add("code", "SEPANLDD", false, false);
            request204.QueryStringParameters.Add("shortname", "SEPA+incasso+Nederland", false, false);
            yield return(request204);

            request204 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_paylist.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_3");
            WebTestRequest request205 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request205.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request205.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request205.QueryStringParameters.Add("since", "2018-09-04T08:53:57.990Z", false, false);
            yield return(request205);

            request205 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_3");

            webTest.EndTransaction(WebBTPrefix + "Click_SEPAIncasso");
            #endregion

            Thread.Sleep(2000);
            var txtPaydate = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");
            var txtYear    = DateTime.Now.AddDays(1).Year.ToString();
            var txtPeriod  = DateTime.Now.AddDays(1).Month.ToString();

            #region ClickNext_ToCreatePayAndCollectTransaction
            webTest.BeginTransaction(WebBTPrefix + "ClickNext_ToCreatePayAndCollectTransaction");
            WebRequestPrefix = "Next2_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_paylist.aspx_2");
            WebTestRequest request207 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/paylist.aspx"));
            request207.Method = "POST";
            request207.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx");
            request207.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/paylist.aspx?treebase=%23PAY%3a&code=SEPANLDD&shortname=SEPA+incasso+Nederland")));
            FormPostHttpBody request207Body = new FormPostHttpBody();
            request207Body.FormPostParameters.Add("hdnFromForm", "1");
            request207Body.FormPostParameters.Add("txtPaydate", txtPaydate);
            request207Body.FormPostParameters.Add("txtYear", txtYear);
            request207Body.FormPostParameters.Add("txtPeriod", txtPeriod);
            request207Body.FormPostParameters.Add("rdiMethod", "1");
            request207Body.FormPostParameters.Add("chkRemove", "1");
            request207Body.FormPostParameters.Add("txtBank", "BNK");
            request207Body.FormPostParameters.Add("txtBankText", "Standaard bank");
            request207Body.FormPostParameters.Add("hdnCode", "SEPANLDD");
            request207Body.FormPostParameters.Add("txtTempXmlID", "0");
            request207Body.FormPostParameters.Add("txtWarnedFields", "");
            request207Body.FormPostParameters.Add("txtFrom3", "");
            request207Body.FormPostParameters.Add("txtFromN3", "");
            request207Body.FormPostParameters.Add("txtTo3", "");
            request207Body.FormPostParameters.Add("txtToN3", "");
            request207Body.FormPostParameters.Add("hdnListID1", "3");
            request207Body.FormPostParameters.Add("txtFrom5", "");
            request207Body.FormPostParameters.Add("hdnListID2", "5");
            request207Body.FormPostParameters.Add("txtFrom6", "");
            request207Body.FormPostParameters.Add("hdnListID3", "6");
            request207Body.FormPostParameters.Add("txtDiscountDaysTolerance", "0");
            request207Body.FormPostParameters.Add("hdnAskCount", "3");
            request207Body.FormPostParameters.Add("btnNext.x", "Next >");
            request207.Body = request207Body;
            yield return(request207);

            request207 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_paylist.aspx_2");

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_11");
            WebTestRequest request207DependentRequest = new WebTestRequest(webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx");
            request207DependentRequest.Method = "GET";
            request207DependentRequest.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/paylist.aspx?treebase=%23PAY%3a&code=SEPANLDD&shortname=SEPA+incasso+Nederland")));
            yield return(request207DependentRequest);

            request207DependentRequest = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_11");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_4");
            WebTestRequest request208 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request208.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request208.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request208.QueryStringParameters.Add("since", "2018-09-04T08:53:57.990Z", false, false);
            yield return(request208);

            request208 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_4");

            webTest.EndTransaction(WebBTPrefix + "ClickNext_ToCreatePayAndCollectTransaction");
            #endregion

            Thread.Sleep(2000);

            string tempXmlId         = webTest.Context["tempXmlId"].ToString();
            string hdnRowCount       = webTest.Context["hdnRowCount"].ToString();
            string hdnFromForm       = webTest.Context["hdnFromForm"].ToString();
            string txtButtonPushedId = webTest.Context["txtButtonPushedId"].ToString();

            #region ClickRefresh_ToCheckTransactionCompletedOrNot
            webTest.BeginTransaction(WebBTPrefix + "ClickRefresh_ToCheckTransactionCompletedOrNot");
            WebRequestPrefix = "RT_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_1");
            WebTestRequest request209 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            request209.Method = "POST";
            request209.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            FormPostHttpBody request209Body = new FormPostHttpBody();
            request209Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            request209Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            request209Body.FormPostParameters.Add("hdnRowCount", hdnRowCount);             // "1");
            request209Body.FormPostParameters.Add("hdnFromForm", hdnFromForm);             // "1");
            request209Body.FormPostParameters.Add("txtButtonPushedId", txtButtonPushedId); // "");
            request209Body.FormPostParameters.Add("tempXml", tempXmlId);                   // "1885566339");
            request209.Body = request209Body;
            yield return(request209);

            request209 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_1");

            webTest.EndTransaction(WebBTPrefix + "ClickRefresh_ToCheckTransactionCompletedOrNot");
            #endregion

            Thread.Sleep(2000);

            #region Authorize_PayAndCollectTransaction
            webTest.BeginTransaction(WebBTPrefix + "Authorize_PayAndCollectTransaction");
            WebRequestPrefix = "A_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_2");
            WebTestRequest request210 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            request210.Method = "POST";
            request210.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            FormPostHttpBody request210Body = new FormPostHttpBody();
            request210Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            request210Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            request210Body.FormPostParameters.Add("hdnRowCount", hdnRowCount);
            request210Body.FormPostParameters.Add("hdnFromForm", hdnFromForm);
            request210Body.FormPostParameters.Add("txtButtonPushedId", "btnAuthorise1.x");
            request210Body.FormPostParameters.Add("tempXml", tempXmlId);// "1885566339");
            request210.Body = request210Body;
            yield return(request210);

            request210 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_2");

            webTest.EndTransaction(WebBTPrefix + "Authorize_PayAndCollectTransaction");
            #endregion

            Thread.Sleep(10000);

            #region ClickRefresh_ToCheckAuthorizationCompletedOrNot
            webTest.BeginTransaction(WebBTPrefix + "ClickRefresh_ToCheckAuthorizationCompletedOrNot");
            WebRequestPrefix = "RA_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_3");
            WebTestRequest request211 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            request211.Method = "POST";
            request211.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            FormPostHttpBody request211Body = new FormPostHttpBody();
            request211Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            request211Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            request211Body.FormPostParameters.Add("hdnRowCount", hdnRowCount);
            request211Body.FormPostParameters.Add("hdnFromForm", hdnFromForm);
            request211Body.FormPostParameters.Add("txtButtonPushedId", "");
            request211Body.FormPostParameters.Add("tempXml", tempXmlId);// "1885566339");
            request211.Body = request211Body;
            yield return(request211);

            request211 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_3");

            List <string> extractedValues = new List <string>();
            extractedValues = CommonFunctions.GetBetweenList(webTest.LastResponse.BodyString, "makepayfile.aspx?code=SEPANLDD&amp;number=", "&amp;touched=5\"");
            string paymentFileNumner = extractedValues.Last();


            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_5");
            WebTestRequest request212 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request212.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request212.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request212.QueryStringParameters.Add("since", "2018-09-04T09:01:04.873Z", false, false);
            yield return(request212);

            request212 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_5");

            webTest.EndTransaction(WebBTPrefix + "ClickRefresh_ToCheckAuthorizationCompletedOrNot");
            #endregion

            Thread.Sleep(2000);

            #region CreateTransactionFile
            webTest.BeginTransaction(WebBTPrefix + "CreateTransactionFile");
            WebRequestPrefix = "CTF_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_makepayfile.aspx");
            WebTestRequest request213 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/makepayfile.aspx"));
            request213.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            request213.QueryStringParameters.Add("code", "SEPANLDD", false, false);
            request213.QueryStringParameters.Add("number", paymentFileNumner, false, false);// "1", false, false);
            request213.QueryStringParameters.Add("touched", "5", false, false);
            yield return(request213);

            request213 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_makepayfile.aspx");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_6");
            WebTestRequest request214 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request214.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request214.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request214.QueryStringParameters.Add("since", "2018-09-04T09:02:18.177Z", false, false);
            yield return(request214);

            request214 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_6");

            webTest.EndTransaction(WebBTPrefix + "CreateTransactionFile");
            #endregion

            Thread.Sleep(2000);

            #region CreateFile
            webTest.BeginTransaction(WebBTPrefix + "CreateFile");
            WebRequestPrefix = "CF_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_makepayfile.aspx_1");
            WebTestRequest request215 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/makepayfile.aspx"));
            request215.Method = "POST";
            request215.ExpectedResponseUrl = (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx");
            request215.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/makepayfile.aspx?code=SEPANLDD&number=1&touched=5")));
            FormPostHttpBody request215Body = new FormPostHttpBody();
            request215Body.FormPostParameters.Add("txtPayRun", "SEPANLDD/" + paymentFileNumner); // "SEPANLDD/1")
            request215Body.FormPostParameters.Add("hdnTouched", "5");
            request215Body.FormPostParameters.Add("txtButtonPushedId", "");
            request215Body.FormPostParameters.Add("btnCreate.x", "Create file");
            request215.Body = request215Body;
            yield return(request215);

            request215 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_makepayfile.aspx_1");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_7");
            WebTestRequest request216 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request216.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request216.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request216.QueryStringParameters.Add("since", "2018-09-04T09:02:18.177Z", false, false);
            yield return(request216);

            request216 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_7");

            webTest.EndTransaction(WebBTPrefix + "CreateFile");
            #endregion

            Thread.Sleep(2000);
            tempXmlId         = webTest.Context["tempXmlId"].ToString();
            hdnRowCount       = webTest.Context["hdnRowCount"].ToString();
            hdnFromForm       = webTest.Context["hdnFromForm"].ToString();
            txtButtonPushedId = webTest.Context["txtButtonPushedId"].ToString();

            #region ClickRefresh_ToCheckFileIsCreatedOrNot
            webTest.BeginTransaction(WebBTPrefix + "ClickRefresh_ToCheckFileIsCreatedOrNot");
            WebRequestPrefix = "RF_";

            webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_4");
            WebTestRequest request217 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            request217.Method = "POST";
            request217.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            FormPostHttpBody request217Body = new FormPostHttpBody();
            request217Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            request217Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            request217Body.FormPostParameters.Add("hdnRowCount", hdnRowCount);
            request217Body.FormPostParameters.Add("hdnFromForm", hdnFromForm);
            request217Body.FormPostParameters.Add("txtButtonPushedId", txtButtonPushedId);
            request217Body.FormPostParameters.Add("tempXml", tempXmlId);//"3909505"
            request217.Body = request217Body;
            yield return(request217);

            request217 = null;
            webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_4");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_8");
            WebTestRequest request218 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request218.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request218.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request218.QueryStringParameters.Add("since", "2018-09-04T09:03:32.660Z", false, false);
            yield return(request218);

            request218 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_8");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_9");
            WebTestRequest request219 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request219.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request219.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request219.QueryStringParameters.Add("since", "2018-09-04T09:03:32.660Z", false, false);
            yield return(request219);

            request219 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_9");

            webTest.BeginTransaction(WebRequestPrefix + "api_notifications_10");
            WebTestRequest request220 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            request220.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            request220.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            request220.QueryStringParameters.Add("since", "2018-09-04T09:03:32.660Z", false, false);
            yield return(request220);

            request220 = null;
            webTest.EndTransaction(WebRequestPrefix + "api_notifications_10");

            webTest.EndTransaction(WebBTPrefix + "ClickRefresh_ToCheckFileIsCreatedOrNot");
            #endregion

            #region Commented Reverse Transaction

            //Thread.Sleep(2000);

            //#region ReverseTransaction
            //webTest.BeginTransaction(WebBTPrefix + "ReverseTransaction");
            //WebRequestPrefix = "RTrx_";

            //webTest.BeginTransaction(WebRequestPrefix + "api_notifications_11");
            //WebTestRequest request221 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/api/notifications"));
            //request221.Headers.Add(new WebTestRequestHeader("Accept", "application/vnd.twinfield+json;version=latest"));
            //request221.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/UI/")));
            //request221.QueryStringParameters.Add("since", "2018-09-04T09:03:32.660Z", false, false);
            //yield return request221;
            //request221 = null;
            //webTest.EndTransaction(WebRequestPrefix + "api_notifications_11");

            //webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_5");
            //WebTestRequest request222 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            //request222.Method = "POST";
            //request222.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            //FormPostHttpBody request222Body = new FormPostHttpBody();
            //request222Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            //request222Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            //request222Body.FormPostParameters.Add("hdnRowCount", "1");
            //request222Body.FormPostParameters.Add("hdnFromForm", "1");
            //request222Body.FormPostParameters.Add("txtButtonPushedId", "btnRollBack1.x");
            //request222Body.FormPostParameters.Add("tempXml", "3909505");
            //request222.Body = request222Body;
            //yield return request222;
            //request222 = null;
            //webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_5");

            //webTest.EndTransaction(WebBTPrefix + "ReverseTransaction");
            //#endregion

            //Thread.Sleep(2000);

            //#region RefreshTillReverseOperationCompletes
            //webTest.BeginTransaction(WebBTPrefix + "RefreshTillReverseOperationCompletes");
            //WebRequestPrefix = "RRT_";

            //webTest.BeginTransaction(WebRequestPrefix + "pay_default.aspx_6");
            //WebTestRequest request223 = new WebTestRequest((webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx"));
            //request223.Method = "POST";
            //request223.Headers.Add(new WebTestRequestHeader("Referer", (webTest.Context["AccountingURL"].ToString() + "/pay/default.aspx")));
            //FormPostHttpBody request223Body = new FormPostHttpBody();
            //request223Body.FormPostParameters.Add("hdnNavFirstValue", "1");
            //request223Body.FormPostParameters.Add("hdnNavLinesPerPage", "10");
            //request223Body.FormPostParameters.Add("hdnRowCount", "1");
            //request223Body.FormPostParameters.Add("hdnFromForm", "1");
            //request223Body.FormPostParameters.Add("txtButtonPushedId", "");
            //request223Body.FormPostParameters.Add("tempXml", "3909505");
            //request223.Body = request223Body;
            //yield return request223;
            //request223 = null;
            //webTest.EndTransaction(WebRequestPrefix + "pay_default.aspx_6");

            //webTest.EndTransaction(WebBTPrefix + "RefreshTillReverseOperationCompletes");
            //#endregion
            #endregion

            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                Thread.Sleep(2000);

                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
            }
        }
예제 #14
0
        public IEnumerator <WebTestRequest> GetRequestEnumerator(TwinfieldDBTenant DBTenant, string userDictionaryKey, WebTestRequestPlugin objPlugin)
        {
            var WebBTPrefix = TwinfieldScenarioPrefix.CSI_ + DBTenant.ToString() + "_";

            _textContext = webTest.Context;
            _textContext.TryGetValue("doLogin", out doLogin);
            _textContext.TryGetValue("UserId", out virtualuserId);

            SharedThreadData threadData;

            #region DoLogin
            if (Convert.ToBoolean(doLogin))
            {
                webTest.Context.CookieContainer = new System.Net.CookieContainer();

                try
                {
                    localDictionary = CustomDS.Instance.GetNextRowTwinfield(DBTenant, TwinfieldScenarioName.ClassicSalesInvoices);

                    threadData                = new SharedThreadData(Convert.ToInt32(virtualuserId), this.TestContext);
                    threadData.UserName       = localDictionary["UserName"];
                    threadData.Tenant         = localDictionary["DBTenant"];
                    threadData.CustomerName   = localDictionary["CustomerName"];
                    threadData.hasFullAccess  = localDictionary["hasFullAccess"];
                    threadData.Password       = AssemblyLoad.Password;
                    threadData.ScenarioPrefix = WebBTPrefix;
                    CustomDS.Instance.Save_ClassicSalesInvoices_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ClassicSalesInvoices + " : " + DBTenant + " : LoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not fetched for:" + TwinfieldScenarioName.ClassicSalesInvoices);
                    throw new Exception("Error in reading data for " + TwinfieldScenarioName.ClassicSalesInvoices + " : " + ex.Message);
                }
                if (threadData.hasFullAccess == "0")
                {
                    foreach (var request in webTest.LaunchLogin(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                else
                {
                    foreach (var request in webTest.LaunchLogin_FullAccess(threadData, objPlugin))
                    {
                        yield return(request);
                    }
                }
                //RTMonitor.Write(Color.Green, "Create Invoice Login User: "******"with iteration no :" + threadData.iterationCount + " LoginTime: " + DateTime.Now + "\r\n");
                CustomDS.Instance.Save_ClassicSalesInvoices_UserData(Convert.ToInt32(virtualuserId), threadData, DBTenant);
                //Logger.WriteGeneralLog("Create Invoice : Vuser - " + Convert.ToInt32(virtualuserId).ToString() + " Logged In");
            }
            else
            {
                try
                {
                    threadData = CustomDS.Instance.Get_ClassicSalesInvoices_UserData(Convert.ToInt32(virtualuserId), DBTenant);
                    Logger.WriteGeneralLogUser(TwinfieldScenarioName.ClassicSalesInvoices + " : " + DBTenant + " : NotLoggedIn : " + virtualuserId);
                }
                catch (Exception ex)
                {
                    Logger.WriteGeneralLog("Input Data not saved for :" + TwinfieldScenarioName.ClassicSalesInvoices);
                    throw new Exception("Error in getting data for " + TwinfieldScenarioName.ClassicSalesInvoices + " : " + ex.Message);
                }
            }
            #endregion DoLogin

            WebBTPrefix = threadData.ScenarioPrefix;
            string WebRequestPrefix = "";


            if ((Convert.ToInt32(webTest.Context["iterationNo"]) % Convert.ToInt32(webTest.Context["maxiterationNo"])) == 0)
            {
                foreach (var request in webTest.Logout(threadData, objPlugin))
                {
                    yield return(request);
                }
                //RTMonitor.Write(Color.Green, "User Logout: " + threadData.UserName + " LogOutTime: " + DateTime.Now + "\r\n");
                Thread.Sleep(2000);
            }
        }