简体   繁体   中英

NUnit Running Tests in Parallel

I have a test which loops over a List and runs a test! I would like to however make this run in parallel. Is there a way that I could do this? Can I create my List to be parallelizable?

I guess I figured that out! All I had to do is to call AsParallel on my List!

Assume that I have a List of Id's which is of type String and I want to run a test for each of the entry, I can do the following inside my test method!

myList.AsParallel.SelectMany(entry =>
{
   // execute the test for each of the entry
   // return entry;
});

What I noticed is that the time taken to run all the tests for each element in my List reduced significantly by running them in parallel!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM