Esempio n. 1
0
        /// <summary>Defines the entry point of the application.</summary>
        /// <param name="args">The arguments.</param>
        /// <exception cref="ArgumentOutOfRangeException">args</exception>
        public static void Main(string[] args)
        {
            try
            {
                if (args == null || args.Length < 3)
                {
                    throw new ArgumentOutOfRangeException(nameof(args));
                }

                string   command       = args[0];
                string[] commandParams = SubArray(args, 1, args.Length - 1);
                if (string.Compare(command, "loadtest", true, CultureInfo.InvariantCulture) == 0)
                {
                    var test = new LoadTest(Console.Out, commandParams);
                    test.Run();
                }

                Console.ReadLine();
            }
#pragma warning disable CA1031 // Keine allgemeinen Ausnahmetypen abfangen
            catch (Exception e)
#pragma warning restore CA1031 // Keine allgemeinen Ausnahmetypen abfangen
            {
                Console.Error.WriteLine($"{e.GetType()}: {e.Message}");
                Console.Error.WriteLine($"StackTrage: {e.StackTrace}");
            }
        }
Esempio n. 2
0
        protected LoadTestResult Test <T>() where T : ITest, new()
        {
            LoadTest <T> test =
                new LoadTest <T>(new LoadTestConfiguration
            {
                NumberOfThreads = 10,
                //Duration = TimeSpan.FromMinutes(3),
                Duration                = TimeSpan.FromSeconds(10),
                StartImmediately        = true,
                DelayBetweenThreadStart = TimeSpan.Zero    // TimeSpan.FromMilliseconds(100)
            }, CancellationToken.None);

            //test.Heartbeat += (s, e) => Console.WriteLine(e.Throughput);

            return(test.Run());
        }
Esempio n. 3
0
 private static async Task RunLoadTest()
 {
     var client = new LoadTest();
     await client.Run();
 }