Ejemplo n.º 1
0
 public DataImport(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string matrixName)
 {
     _matrixName             = matrixName;
     _tenant                 = tenant;
     _userLoadTestHttpClient = userLoadTestHttpClient;
     _matrixValues           = new List <string>();
 }
        public async Task Execute(IUserLoadTestHttpClient loadLoadTestHttpClient)
        {
            var test = new ConfigurationV1(loadLoadTestHttpClient, "CPQ_DEV", "Default", "Reservation")
                       .WithIntegrationParameter("ReservationJSON", "", "string")
                       .WithIntegrationParameter("ReferralSourceCode", "", "string")
                       .WithIntegrationParameter("CallingApp", "", "string")
                       .WithIntegrationParameter("Mode", "Reservation", "string")
                       .WithIntegrationParameter("CurrencyCode", "", "string")
                       .WithIntegrationParameter("ExchangeRate", "1", "number");

            try
            {
                await test.StartAsync();

                //await test.ConfigureAsync("ReservationLocation<font color=red>*</font>", "SJUT11ZE", "Location");
                await test.ConfigureAsync("ReservationLocation<font color=red>*</font>", "SJUT11ZE", "Location");

                await test.ConfigureWithRandomOptionAsync("VehicleClass<font color=red>*</font>", new [] { "ANCONL" }, "Vehicle");

                await test.Finalize();

                Console.WriteLine();
            }
            catch (System.Exception)
            {
                Console.WriteLine($"FAILED");
                await test.Cancel();

                //throw e;
            }
        }
Ejemplo n.º 3
0
 public Configuration(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string rulesetNamespace, string ruleset)
 {
     _userLoadTestHttpClient = userLoadTestHttpClient;
     _tenant           = tenant;
     _rulesetNamespace = rulesetNamespace;
     _ruleset          = ruleset;
 }
 public async Task Execute(IUserLoadTestHttpClient loadLoadTestHttpClient)
 {
     var result = new DataImport(loadLoadTestHttpClient, "CPQ_DEV", "AccountAccount")
                  .WithValue("AccountNumber", "100013")
                  .WithValue("CountryCode", "US-1")
                  .UpdateRow("100013", 1);
     await result;
 }
Ejemplo n.º 5
0
 public Configuration(IUserLoadTestHttpClient userLoadTestHttpClient, string baseUrl, string tenant, string rulesetNamespace, string ruleset, string headerId)
 {
     _userLoadTestHttpClient = userLoadTestHttpClient;
     _baseUrl          = baseUrl;
     _tenant           = tenant;
     _rulesetNamespace = rulesetNamespace;
     _ruleset          = ruleset;
     _configurationId  = Guid.NewGuid();
     _headerId         = headerId;
     _profile          = "default";
     _delayInSeconds   = 0;
 }
        public async Task Execute(IUserLoadTestHttpClient loadLoadTestHttpClient)
        {
            await loadLoadTestHttpClient.DelayUserClick();

            var postId = (string)loadLoadTestHttpClient.TestState[PostId];

            await loadLoadTestHttpClient.Get($"posts/{postId}");

            await loadLoadTestHttpClient.DelayUserThink();

            var comment = new Dictionary <string, object>
            {
                { "name", "HttpLoadTesting" },
                { "email", "*****@*****.**" },
                { "body", "Comment body" }
            };

            await loadLoadTestHttpClient.Post($"posts/{postId}/comments", comment);
        }
Ejemplo n.º 7
0
        private async Task <UserIterationResult> ExecuteTest(ILoadTest nextTest, IUserLoadTestHttpClient userLoadClient, Func <TimeSpan> getCurrentTimeSpan)
        {
            var userTime    = ValueStopwatch.StartNew();
            var startedTime = getCurrentTimeSpan();

            Exception exception = null;

            try
            {
                await nextTest.Execute(userLoadClient);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            var elapsedTime = userTime.GetElapsedTime();

            var statusResults = userLoadClient.StatusResults();

            return(new UserIterationResult(_httpUser.BaseUrl, UserNumber, elapsedTime, Iteration, nextTest.Name, statusResults, startedTime, userLoadClient.UserDelay, exception?.ToString()));
        }
Ejemplo n.º 8
0
        private async Task <UserIterationResult> ExecuteTest(ILoadTest nextTest, IUserLoadTestHttpClient userLoadClient)
        {
            _userTime.Restart();
            var startTick = Stopwatch.GetTimestamp();

            Exception exception = null;

            try
            {
                await nextTest.Execute(userLoadClient);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            _userTime.Stop();

            var endTick = startTick + _userTime.ElapsedTicks;

            return(new UserIterationResult(_httpUser.BaseUrl, UserNumber, _userTime.Elapsed, Iteration, nextTest.Name, userLoadClient.StatusResults(), startTick, endTick, userLoadClient.UserDelay, exception?.ToString()));
        }
Ejemplo n.º 9
0
        public async Task Execute(IUserLoadTestHttpClient loadLoadTestHttpClient)
        {
            var test = new ConfigurationV2(loadLoadTestHttpClient, _tenant, "AMC", "Wood Door v1")
                       .WithIntegrationParameter("CurrencyCode", "", "string")
                       .WithIntegrationParameter("ExchangeRate", "1", "number");

            try
            {
                await test.StartAsync();

                await test.ConfigureWithRandomOptionAsync("Select your wood species:", new string[] { }, "Species");

                await test.ConfigureWithRandomOptionAsync("Stain Color:", new string[] { }, "Stain");

                await test.Continue();

                await test.ConfigureAsync("Door Style:", "AA", "Set Style");

                await test.ConfigureAsync("Width:", "28", "Width");

                await test.ConfigureAsync("Height:", "84", "Height");

                await test.ConfigureAsync("Hinges:", "True", "Hinges");

                await test.Finalize();

                Console.WriteLine("Success");
            }
            catch (System.Exception e)
            {
                Console.WriteLine($"FAILED {e.Message}");
                await test.Cancel();

                //throw e;
            }
        }
 public ConfigurationV1(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string rulesetNamespace, string ruleset, string headerId = "Fixture-v1")
     : base(userLoadTestHttpClient, "ConfiguratorServiceInternal/v3", tenant, rulesetNamespace, ruleset, headerId)
 {
 }
Ejemplo n.º 11
0
        public async Task Execute(IUserLoadTestHttpClient loadLoadTestHttpClient)
        {
            //await loadLoadTestHttpClient.DelayUserClick();

            await loadLoadTestHttpClient.Get("");
        }
Ejemplo n.º 12
0
 public static Task DelayUserClick(this IUserLoadTestHttpClient client, int min = 500, int max = 1000)
 {
     return(client.LogUserDelay(() => Task.Delay(Rand.Random(min, max))));
 }
Ejemplo n.º 13
0
 public ConfigurationV1(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string rulesetNamespace, string ruleset)
     : base(userLoadTestHttpClient, tenant, rulesetNamespace, ruleset)
 {
 }
Ejemplo n.º 14
0
 public ConfigurationV2(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string rulesetNamespace, string ruleset, string headerId = "Fixture-v2")
     : base(userLoadTestHttpClient, "api/v4", tenant, rulesetNamespace, ruleset, headerId)
 {
 }
Ejemplo n.º 15
0
 public ConfigurationCompare(IUserLoadTestHttpClient userLoadTestHttpClient, string tenant, string rulesetNamespace, string ruleset)
 {
     _v1 = new ConfigurationV1(userLoadTestHttpClient, tenant, rulesetNamespace, ruleset);
     _v2 = new ConfigurationV2(userLoadTestHttpClient, tenant, rulesetNamespace, ruleset);
 }
Ejemplo n.º 16
0
        public async Task Execute(IUserLoadTestHttpClient loadTestHttpClient)
        {
            await loadTestHttpClient.Get("");

            //await Task.Delay(50);
        }