public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            ITestContext context = new TestContext(e, AuthenticationInfo.Authorization);

            context.Add(TestContextConst.BaseUri, e.WebTest.Context[TestContextConst.BaseUri]);
            context.SetEventArgs(e);
            e.WebTest.Context[TestContextConst.ContextKey] = context;
            //TestContext.Context = context;
            //TestContext.Context.SetEventArgs(e);

            base.PreWebTest(sender, e);
            string     loginUri     = TemplateHelper.CompileTemplate(this.Url, context);
            var        loginRequest = new LoginRequest(this.UserName, this.Password);
            IConnector connector    = new RESTConnector();
            IResponseData <LoginResponse> response = connector.Post <LoginRequest, LoginResponse>(loginUri, loginRequest);

            if (response.HasError())
            {
                e.WebTest.Stop();
                return;
            }
            e.WebTest.Context.Add(LoadTestConst.Authorization, response.Data.Authorization);
            AuthenticationInfo.Authorization = new Authorization(response.Data.Authorization, response.Data.AuthToken);

            context = e.WebTest.Context[TestContextConst.ContextKey] as ITestContext;
            context.SetAuthorization(AuthenticationInfo.Authorization);
        }
 private void SetUp(object sender, PreWebTestEventArgs e)
 {
     try
     {
         MTApiFunctionalities mtApi = new MTApiFunctionalities();
         JObject userInfo           = mtApi.GenerateUserInfo();
         username = userInfo["username"].ToString();
         password = userInfo["password"].ToString();
         email    = userInfo["email"].ToString();
         HttpWebResponse httpResCreate = mtApi.CreateUser(mtUrl, username, password, email);
         httpResCreate.Close();
         HttpWebResponse httpResLogin      = mtApi.LoginUser(mtUrl, username, password);
         JObject         jsonResponseLogin = mtApi.JsonParseHttpRes(httpResLogin);
         userId = jsonResponseLogin["id"].ToString();
         httpResLogin.Close();
         HttpWebResponse httpResAdminLogin      = mtApi.LoginUser(mtUrl, adminUsername, adminPassword);
         JObject         jsonResponseAdminLogin = mtApi.JsonParseHttpRes(httpResAdminLogin);
         adminLoginToken = jsonResponseAdminLogin["token"].ToString();
         httpResAdminLogin.Close();
     }
     catch (WebException webExc)
     {
         Stop();                           // Stop test on exception
         Outcome           = Outcome.Fail; // Fail web test due to exception
         this.PostWebTest += TearDown;     // Add TearDown to make sure if user exists, it gets deleted
     }
 }
Example #3
0
    public override void PreWebTest(object sender, PreWebTestEventArgs e)
    {
        int lti = (int)e.WebTest.Context["$LoadTest.TestIterationNumber"];
        int wti = e.WebTest.Context.WebTestIteration;

        System.Diagnostics.Debug.Assert(lti == wti, String.Format("$LoadTestIteration {0} differs from $WebTestIteration {1}", lti, wti));
    }
Example #4
0
		public override void PreWebTest(object sender, PreWebTestEventArgs e)
		{
			var rng = new RNGCryptoServiceProvider();
			byte[] random = new byte[RandomValueCount];
			rng.GetBytes(random);
			var value = BitConverter.ToString(random).Replace("-", "");
			e.WebTest.Context.Add(ParameterName, value + Postfix);
		}
Example #5
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            base.PreWebTest(sender, e);

            string value = GenerateRandomString() + this.Addition;

            e.WebTest.Context.Add(this.ParameterName, value);
        }
Example #6
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            base.PreWebTest(sender, e);

            string value = GenerateRandomString() + this.Addition;

            e.WebTest.Context.Add(this.ParameterName, value);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            using (ClientContext clientContext = new ClientContext(_siteUrl))
            {
                Uri    siteUri  = new Uri(_siteUrl);
                string username = e.WebTest.UserName;
                string password = e.WebTest.Password;
                try
                {
                    if (username.Contains("{{"))
                    {
                        //looks to be a databound field
                        var usernamekey = e.WebTest.UserName.Replace("{{", "").Replace("}}", "");
                        username = (string)e.WebTest.Context[usernamekey];
                    }
                    if (password.Contains("{{"))
                    {
                        //looks to be a databound field
                        var passwordkey = e.WebTest.Password.Replace("{{", "").Replace("}}", "");
                        password = (string)e.WebTest.Context[passwordkey];
                    }
                }
                catch (Exception ex)
                {
                    e.WebTest.Outcome = Outcome.Fail;
                    e.WebTest.AddCommentToResult(ex.Message);
                }

                SecureString securePassword = new SecureString();
                foreach (char c in password.ToCharArray())
                {
                    securePassword.AppendChar(c);
                }
                var credentials = new SharePointOnlineCredentials(username, securePassword);
                try
                {
                    string authCookieValue = credentials.GetAuthenticationCookie(siteUri);
                    authCookieValue = authCookieValue.Replace("SPOIDCRL=", "");
                    var cc = e.WebTest.Context.CookieContainer;
                    cc.Add(new Cookie(
                               "FedAuth",
                               authCookieValue,
                               String.Empty,
                               siteUri.Authority));
                    Console.WriteLine(authCookieValue);
                }
                catch (IdcrlException ex)
                {
                    e.WebTest.Outcome = Outcome.Fail;
                    e.WebTest.AddCommentToResult(ex.Message);
                }
            }

            base.PreWebTest(sender, e);
        }
Example #8
0
 public override void PreWebTest(object sender, PreWebTestEventArgs e)
 {
     //if (string.IsNullOrEmpty(this.ContextParameterName))
     //{
     //    throw new ArgumentNullException();
     //}
     //Token = GetAccessTokenAsync(ClientId, AadInstance, Tenant, ClientSecret).Result;
     Token = GetDataCopToken(this.TenantId, this.ClientId, this.ClientSecret, this.Resource).Result;
     //e.WebTest.Context[ContextParameterName] = Token;
     //httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", jwt);
 }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            string firstName = "First_" + System.DateTime.Now.ToString("ddMM") + System.DateTime.Now.ToString("HHmmss") + "_" + e.WebTest.Context.WebTestUserId.ToString() + "_" + e.WebTest.Context.WebTestIteration.ToString();
            string lastName  = "Last_" + System.DateTime.Now.ToString("ddMM") + System.DateTime.Now.ToString("HHmmss") + "_" + e.WebTest.Context.WebTestUserId.ToString() + "_" + e.WebTest.Context.WebTestIteration.ToString();
            string eMail     = "First_" + System.DateTime.Now.ToString("ddMM") + System.DateTime.Now.ToString("HHmmss") + "_" + e.WebTest.Context.WebTestUserId.ToString() + "_" + e.WebTest.Context.WebTestIteration.ToString() + "@mailinator.com";

            NewUser(firstName, lastName, eMail);

            e.WebTest.Context[ContextParamTarget] = eMail;
            base.PreWebTest(sender, e);
        }
Example #10
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            base.PreWebTest(sender, e);

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;


            e.WebTest.AddCommentToResult(this.ToString() + " has made the following modification-> ServicePointManager.SecurityProtocol set to use Tlsv12 in WebTest Plugin.");
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            // Generate new guid with specified output format
            string firstName = string.Empty;

            firstName = "First_" + System.DateTime.Now.ToString("ddMM") + System.DateTime.Now.ToString("HHmmss") + "_" + e.WebTest.Context.WebTestUserId.ToString() + "_" + e.WebTest.Context.WebTestIteration.ToString();

            // Set the context paramaeter with generated lastname
            e.WebTest.Context[ContextParamTarget] = firstName;
            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            var random = new Random();

            var randomValue  = random.Next(this.MinValue, this.MaxValue);
            var outputString = string.Format(this.InputFormat, randomValue);

            // Set the context paramaeter with generated guid
            e.WebTest.Context[ContextParamTarget] = outputString;

            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            var random = new Random();

            var randomValue = random.Next(this.MinValue, this.MaxValue);
            var outputString = string.Format(this.InputFormat, randomValue);

            // Set the context paramaeter with generated guid
            e.WebTest.Context[ContextParamTarget] = outputString;

            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            base.PreWebTest(sender, e);

            // We're using SSL3 here and not TLS. Without this line, nothing works.
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            //we wire up the callback so we can override  behavior and force it to accept the cert
            ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;

            //let them know we made changes to the service point manager
            e.WebTest.AddCommentToResult(this.ToString() + " has made the following modification-> ServicePointManager.SecurityProtocol set to use SSLv3 in WebTest Plugin.");
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            string setTrigger = Boolean.FalseString;

            for (int i = 0; i <= IterationCounter; i++)
            {
                setTrigger = Boolean.TrueString;
            }

            e.WebTest.Context[ContextParamTarget] = setTrigger;

            base.PreWebTest(sender, e);
        }
Example #16
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            if (e.WebTest.Context.ContainsKey("$LoadTestUserContext"))
            {
                LoadTestUserContext loadTestUserContext =
                    e.WebTest.Context["$LoadTestUserContext"] as LoadTestUserContext;

                if (e.WebTest.Context[Constants.Context_ReuseConvId].ToString().Equals("true", StringComparison.OrdinalIgnoreCase))
                {
                    if (loadTestUserContext.ContainsKey(Constants.Context_ConvId))
                    {
                        e.WebTest.Context[Constants.Context_ConvId] = loadTestUserContext[Constants.Context_ConvId].ToString();
                    }
                }

                if (e.WebTest.Context[Constants.Context_ReuseUserId].ToString().Equals("true", StringComparison.OrdinalIgnoreCase))
                {
                    if (loadTestUserContext.ContainsKey(Constants.Context_UserId))
                    {
                        e.WebTest.Context[Constants.Context_UserId] = loadTestUserContext[Constants.Context_UserId].ToString();
                    }
                }

                if (loadTestUserContext.ContainsKey(Constants.Context_AccessToken))
                {
                    e.WebTest.Context[Constants.Context_AccessToken] = loadTestUserContext[Constants.Context_AccessToken].ToString();
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Helpers.ConvId))
                {
                    e.WebTest.Context[Constants.Context_ConvId] = Helpers.ConvId;
                }

                if (!string.IsNullOrEmpty(Helpers.AccessToken))
                {
                    e.WebTest.Context[Constants.Context_AccessToken] = Helpers.AccessToken;
                }
            }

            if (!e.WebTest.Context.ContainsKey("JwtToken"))
            {
                App app = new App()
                {
                    AppId  = e.WebTest.Context["BotAppId"].ToString(),
                    AppKey = e.WebTest.Context["BotAppKey"].ToString()
                };
                e.WebTest.Context["JwtToken"] = Helpers.GetJwtToken(app);
            }
        }
Example #17
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            e.WebTest.AddCommentToResult("Äripäeva API webtest plugin kontrollib apide artiklite avaldamis aegu.");

            if (!CheckAripaevMostViewed())
            {
                e.WebTest.AddCommentToResult("FAILED: Äripäeva enimvaadatud artiklites ei ole ühtegi artiklit, mis oleks uuem kui 2 päeva (Või ei saadud API-ga ühendust).");
                e.WebTest.InternalSetOutcome(Outcome.Fail);
            }
            else
            {
                e.WebTest.AddCommentToResult("SUCCESS: Äripäevas leidub uuemaid artikleid, kui 2 päeva.");
            }


            if (!CheckDvMostViewed())
            {
                e.WebTest.AddCommentToResult("FAILED:DV enimvaadatud artiklites ei ole ühtegi artiklit, mis oleks uuem kui 3 päeva (Või ei saadud API-ga ühendust).");
                e.WebTest.InternalSetOutcome(Outcome.Fail);
            }
            else
            {
                e.WebTest.AddCommentToResult("SUCCESS: DV-s leidub uuemaid artikleid, kui 3 päeva");
            }


            if (!CheckRaamatupidaja35Fresh())
            {
                e.WebTest.AddCommentToResult("FAILED:Raamatupidaja artiklites ei ole ühtegi artiklit, mis oleks uuem kui 7 päeva (Või ei saadud API-ga ühendust).");
                e.WebTest.InternalSetOutcome(Outcome.Fail);
            }
            else
            {
                e.WebTest.AddCommentToResult("SUCCESS: Raamatupidaja artiklite seas leidub uuemaid kui 7 päeva.");
            }


            if (!CheckEditorsChoice())
            {
                e.WebTest.AddCommentToResult("FAILED:Raamatupidaja editors choice artiklites ei ole ühtegi artiklit, mis oleks uuem kui 7 päeva (Või ei saadud API-ga ühendust).");
                e.WebTest.InternalSetOutcome(Outcome.Fail);
            }
            else
            {
                e.WebTest.AddCommentToResult("SUCCESS: Editors choice artiklites leidub artikleid, mis oleks uuemad kui 7 päeva.");
            }

            base.PreWebTest(sender, e);
        }
Example #18
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            if (string.IsNullOrEmpty(ContextParameter))
            {
                throw new ArgumentException(this.ToString() + "Error --> ContextParameter property cannot be null or empty. Please define a context paramater to output the random number.");
            }

            if (MinimumValue > MaximumValue + 1)
            {
                throw new ArgumentOutOfRangeException(this.ToString() + "Error --> The property for the MinimumValue must less than or equal to MaximumValue.");
            }

            //note the Random.Next() method creates a random number based on the min, and max values, however the max value returnd is one less than specified
            //so we add one here so that it works the way most people would intuitively expect.
            e.WebTest.Context[ContextParameter] = new Random().Next(MinimumValue, MaximumValue + 1).ToString();
        }
Example #19
0
 public void SetUp(object sender, PreWebTestEventArgs e)
 {
     try
     {
         MTApiFunctionalities mtApi = new MTApiFunctionalities();
         JObject userInfo           = mtApi.GenerateUserInfo();
         username = userInfo["username"].ToString();
         password = userInfo["password"].ToString();
         email    = userInfo["email"].ToString();
     }
     catch (WebException webExc)
     {
         Stop();                 // Stop test on exception
         Outcome = Outcome.Fail; // Fail web test due to exception
     }
 }
Example #20
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            // Generate new guid with specified output format
            var newGuid = System.Guid.NewGuid().ToString(OutputFormat);

            // Create substring of specified length
            if (GuidLength > 0 && GuidLength < newGuid.Length)
            {
                newGuid = newGuid.Substring(0, GuidLength - 1);
            }

            // Set the context paramaeter with generated guid
            e.WebTest.Context[ContextParamTarget] = newGuid;

            base.PreWebTest(sender, e);
        }
Example #21
0
        /// <summary>
        /// Handle the event associated with the start of a Web performance test.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A PreWebTestEventArgs that contains the event data.</param>
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            if (string.IsNullOrEmpty(EmailDomain))
            {
                throw new ArgumentException("Error --> EmailDomain property cannot be null or empty. Please use a non-empty string for email domain.");
            }

            Random r = new Random();
            int    n = r.Next(0, this.names.Length - 1);
            int    f = r.Next(0, this.families.Length - 1);

            e.WebTest.Context[RandomEmail]      = $"{Guid.NewGuid()}@{EmailDomain}";
            e.WebTest.Context[RandonDispayName] = $"{AppSettingsPlugin.SignUpDisplayNamePrefix}{names[n]} {families[f]}";
            e.WebTest.Context[RandonGivenName]  = names[n];
            e.WebTest.Context[RandomSurename]   = families[f];
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            string setTrigger = Boolean.FalseString;

            if ((e.WebTest.Context.WebTestIteration) % Iter == 0)
            {
                setTrigger = Boolean.TrueString;
            }

            e.WebTest.Context[ContextParamTarget] = setTrigger;

            //e.WebTest.AddCommentToResult(this.ToString() + " Iteration set to: " + Iter);
            //e.WebTest.AddCommentToResult(this.ToString() + " Result: " + (e.WebTest.Context.WebTestIteration) % Iter);
            //e.WebTest.AddCommentToResult(this.ToString() + " Trigger: " + e.WebTest.Context[ContextParamTarget]);
            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            object contextParameterObject;

            if (e.WebTest.Context.TryGetValue(DataFile,
                                              out contextParameterObject))
            {
                string PayRef = contextParameterObject.ToString();

                DBReset(PayRef);
            }
            else
            {
                throw new WebTestException(DataFile + "'DataFile' not found");
            }
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            Random randomGenerator     = new Random();
            string ULRN                = string.Empty;
            string availableCharacters = "123456789";

            //ULRN = System.DateTime.Now.ToString("ddMM") + System.DateTime.Now.ToString("HHmm");

            for (int characterIndex = 0; characterIndex <= 9; characterIndex++)
            {
                ULRN = ULRN + availableCharacters[randomGenerator.Next(availableCharacters.Length)].ToString();
            }

            e.WebTest.Context[ContextParamTarget] = ULRN;
            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            e.WebTest.Context["ClientId"]     = ClientId;
            e.WebTest.Context["PolicyId"]     = PolicyId;
            e.WebTest.Context["RedirectUri"]  = RedirectUri;
            e.WebTest.Context["TenantId"]     = TenantId;
            e.WebTest.Context["Host"]         = Host;
            e.WebTest.Context["Password"]     = SignInOrSignUpPassword;
            e.WebTest.Context["State"]        = StateParam;
            e.WebTest.Context["ResponseMode"] = ResponseMode;

            // Signin web test only
            if (e.WebTest.Name.ToLower().Contains("signin"))
            {
                e.WebTest.Context["Username"] = SignInUser;
            }
            base.PreWebTest(sender, e);
        }
Example #26
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            //loading the settings files

            WebTestSettings webTestSettings = new WebTestSettings();
            webTestSettings.ReadConfig("WebTestSettings.xml");

            //startig the web server
            WebServerHelper.StartWebServerIfNotStarted(webTestSettings.WebServerExePath);

            //setting up set-up data
            SqlClientScriptRunner.RunScript(webTestSettings.SqlConnectionString, @"..\..\..\..\Eisk.Database\Basic Scripts\Schema\Create-Schema.sql");
            SqlClientScriptRunner.RunScript(webTestSettings.SqlConnectionString, @"..\..\..\..\Eisk.Database\Basic Scripts\Data\Create-Data.sql");

            //message

            //MessageBox.Show("Web Test Starting ...");
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            String ULRN = GenerateRandomNumberBetweenTwoValues(10, 99).ToString() + DateTime.Now.ToString("ssffffff");

            for (int i = 1; i < 30; i++)
            {
                if (IsValidCheckSum(ULRN))
                {
                    break;
                }
                else
                {
                    ULRN = (long.Parse(ULRN) + 1).ToString();
                }
            }
            e.WebTest.Context[ContextParamTarget] = ULRN;
            base.PreWebTest(sender, e);
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            //DB Connection values from Test Data File
            object datafileDBConnectionString;

            string DBConnectionValue = null;


            // Get DB Connection values from Test Data File
            if (e.WebTest.Context.TryGetValue(DBConnectionDataFile, out datafileDBConnectionString))
            {
                DBConnectionValue = datafileDBConnectionString.ToString();
                e.WebTest.AddCommentToResult("DB Connection = " + DBConnectionValue);

                // Debug
                //var webContextParameters = e.WebTest.Context;
                //webContextParameters.Add("DBConnectionString", DBConnectionValue);
                // Debug
            }
            else
            {
                throw new WebTestException(PayeSchemeDataFile + "' - Test Data File' not found");
            }

            // PAYE Scheme values from Test Data File
            object dataFilePayeSchemeValue;

            // Get PAYE Scheme values from Test Data File
            if (e.WebTest.Context.TryGetValue(PayeSchemeDataFile, out dataFilePayeSchemeValue))
            {
                string PayeSchemeReference = dataFilePayeSchemeValue.ToString();

                // Debug
                //string PayeSchemeValue = dataFilePayeSchemeValue.ToString();
                //e.WebTest.AddCommentToResult("PAYE Scheme = " + PayeSchemeValue);
                // Debug

                DBReset(PayeSchemeReference, DBConnectionValue);
            }
            else
            {
                throw new WebTestException(PayeSchemeDataFile + "' - Test Data File' not found");
            }
        }
        public static void PreWebTestEvent(object sender, PreWebTestEventArgs e)
        {
            if (!AssemblyLoad.isInitialized)
            {
                lock (assemblyinitializeLock)
                {
                    if (!AssemblyLoad.isInitialized)
                    {
                        //comment while debugging thats safe
                        AssemblyLoad.AssemblyInitWeb(e.WebTest.Context);
                        e.WebTest.Context.Add("LoginMain", AssemblyLoad.LoginMain);
                        e.WebTest.Context.Add("AccountingURL", AssemblyLoad.AccountingURL);
                        e.WebTest.Context.Add("TwfcndURL", AssemblyLoad.TwfcndURL);
                    }

                    AssemblyLoad.isInitialized = true;
                }
            }
        }
Example #30
0
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            //loading the settings files

            WebTestSettings webTestSettings = new WebTestSettings();

            webTestSettings.ReadConfig("WebTestSettings.xml");

            //startig the web server
            WebServerHelper.StartWebServerIfNotStarted(webTestSettings.WebServerExePath);


            //setting up set-up data
            SqlClientScriptRunner.RunScript(webTestSettings.SqlConnectionString, @"..\..\..\..\Eisk.Database\Basic Scripts\Schema\Create-Schema.sql");
            SqlClientScriptRunner.RunScript(webTestSettings.SqlConnectionString, @"..\..\..\..\Eisk.Database\Basic Scripts\Data\Create-Data.sql");

            //message

            //MessageBox.Show("Web Test Starting ...");
        }
 private void SetUp(object sender, PreWebTestEventArgs e)
 {
     try
     {
         MTApiFunctionalities mtApi = new MTApiFunctionalities();
         JObject userInfo           = mtApi.GenerateUserInfo();
         username = userInfo["username"].ToString();
         password = userInfo["password"].ToString();
         email    = userInfo["email"].ToString();
         HttpWebResponse httpResCreate = mtApi.CreateUser(mtUrl, username, password, email);
         JObject         jsonResponse  = mtApi.JsonParseHttpRes(httpResCreate);
         userId = jsonResponse["id"].ToString();
         httpResCreate.Close();
     }
     catch (WebException webExc)
     {
         Stop();                 // Stop test on exception
         Outcome = Outcome.Fail; // Fail web test due to exception
     }
 }
 public override void PreWebTest(object sender, PreWebTestEventArgs e)
 {
     //confirm the target context param exists
     if (e.WebTest.Context.ContainsKey(ContextParamTarget))
     {
         //is the ContextParmOrValueSource a Context Parameter or a hard coded value?
         if (e.WebTest.Context.ContainsKey(ContextParamOrValueSource))
         {
             e.WebTest.Context[ContextParamTarget] += e.WebTest.Context[ContextParamOrValueSource].ToString();
         }
         else
         {
             e.WebTest.Context[ContextParamTarget] += ContextParamOrValueSource;
         }
     }
     else
     {
         throw new ArgumentException("Required Context Parameter Target was not found");
     }
 }
        public override async void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            ClientId       = Configuration["ADAL:clientId"];
            AppKey         = Configuration["General:appkey"];
            Tenant         = Configuration["General:Tenant"];
            AadInstance    = Configuration["General:AADInstance"];
            ToDoResourceId = Configuration["General:SiteURL"];
            UserName       = Configuration["General:AdminUserName"];
            PassWord       = Configuration["General:AdminPassword"];
            PerfAppId      = Configuration["General:PerfAppID"];

            Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext authContext = new Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext(authority);
            ClientCredential clientCredential = new ClientCredential(ClientId, AppKey);

            UserPasswordCredential user = new UserPasswordCredential(UserName, PassWord);

            var result = authContext.AcquireTokenAsync(ClientId, PerfAppId, user).Result;

            e.WebTest.Context[TokenValue] = "Bearer " + result.AccessToken;
        }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            e.WebTest.Context[ContextParamAccountTarget]     = Settings.AccountsURL.AccountTarget;
            e.WebTest.Context[ContextParamApprenticesTarget] = Settings.ApprenticesURL.ApprenticesTarget;
            e.WebTest.Context[ContextParamFinanceTarget]     = Settings.FinanceURL.FinanceTarget;
            e.WebTest.Context[ContextParamForecastingTarget] = Settings.ForecastingURL.ForecastingTarget;
            e.WebTest.Context[ContextParamPermissionsTarget] = Settings.PermissionsURL.PermissionTarget;
            e.WebTest.Context[ContextParamRecruitTarget]     = Settings.RecruitURL.RecruitTarget;
            e.WebTest.Context[ContextParamTarget]            = Settings.LandingURL.LandingTarget;
            e.WebTest.Context[ContextParamLoginTarget]       = Settings.LoginURL.LoginTarget;
            e.WebTest.Context[ContextParamReportingTarget]   = Settings.ReportingURL.ReportingTarget;
            e.WebTest.Context[ContextParamPASTarget]         = Settings.PASURL.PASTarget;

            if (PerformanceTest.Default.TestEnvironment == "test2")
            {
                e.WebTest.Context[ContextParamApprenticesTarget] = Settings.ApprenticesURLT2.ApprenticesTarget;
                e.WebTest.Context[ContextParamFinanceTarget]     = Settings.FinanceURLT2.FinanceTarget;
                e.WebTest.Context[ContextParamForecastingTarget] = Settings.ForecastingURLT2.ForecastingTarget;
            }
            base.PreWebTest(sender, e);
        }
Example #35
0
		public override void PreWebTest(object sender, PreWebTestEventArgs e)
		{
			e.WebTest.MoveDataTableCursor("CreditCards", "CreditCard", e.WebTest.Context.WebTestUserId);
		}
Example #36
0
 public override void PreWebTest(object sender, PreWebTestEventArgs e)
 {
     randomTxt = generateCurrentDate();
     e.WebTest.Context["CurrentDate"] = randomTxt;
     base.PreWebTest(sender, e);
 }
        public override void PreWebTest(object sender, PreWebTestEventArgs e)
        {
            base.PreWebTest(sender, e);

            e.WebTest.Context[ContextParameterName] = "http://localhost/LoadTestWebApp/";
        }
Example #38
0
 public override void PreWebTest(object sender, PreWebTestEventArgs e)
 {
     randomTxt = generateRandomId();
     e.WebTest.Context["Seed"] = randomTxt;
     base.PreWebTest(sender, e);
 }
Example #39
0
        private void OnPreWebTest(object sender, PreWebTestEventArgs preWebTestEventArgs)
        {
            try
            {
                StartUp();
            }
            catch (Exception ex)
            {
                preWebTestEventArgs.WebTest.Outcome = Outcome.Fail;
                preWebTestEventArgs.WebTest.AddCommentToResult("Startup failed: " + ex.ToString());
            }

        }
 public override void PreWebTest(object sender, PreWebTestEventArgs e)
 {
     // When overridden in a derived class, represents the method
     // that will handle the event associated with the start of a Web performance test.
     base.PreWebTest(sender, e);
 }