-4

i want to create test case which allow to hit 50 times at a time get their results individually.

want to know what happen if 50 people come at a time

  • Do you want to write an automated test or do you want to write a test case? If you want to write a test case, maybe try [Software Quality Assurance Stack Exchange](https://sqa.stackexchange.com/) – John Wu Apr 18 '18 at 16:53
  • Look at the load testing tools in Visual Studio. – Dragonthoughts Apr 18 '18 at 16:56
  • @JohnWu i want to write test case but it should not in foreach – ismail bhinder Apr 18 '18 at 16:58
  • I think you want to write an automated test or a test *script*, which is a program that executes a test. A test *case* is written in English (or the language of your department) and describes preconditions, steps, and expected outcome, so a QA engineer can execute it with precision and repeatability. – John Wu Apr 18 '18 at 17:14

2 Answers2

0

I you looking to create a load test then you can use visual studio enterprise 2017 to create and run load test.

Also you can use a free tool like JMeter not that fancy but it gets the job done.

migabriel
  • 58
  • 5
0

You didn't mention why you don't want to use foreach, but here is a way to do it with LINQ, assuming you have a single-user test that can be invoked with a function named ExecuteTestForAUser() (yours may differ):

const numberOfTests = 50;
var tasks = Enumerable.Range(1, numberOfTests)
    .Select
    ( 
        i => Task.Run( () => ExecuteTestForAUser() ) 
    )
    .ToArray();
Task.WaitAll( tasks );

This code produces a list of 50 integers using Enumerable.Range. It then converts the list into a list of 50 tasks using Select. Task.Run() will put each task on the thread pool. Then Task.WaitAll() will block execution until they have all completed.

You will need to make sure ExecuteTestForAUser() is thread-safe.

John Wu
  • 50,556
  • 8
  • 44
  • 80