MobileNativeFoundation / bluepill

Bluepill is a reliable iOS testing tool that runs UI tests using multiple simulators on a single machine
BSD 2-Clause "Simplified" License
3.19k stars 232 forks source link

Duplicate bundles for repeats before minimizing simulator count #431

Closed RainNapper closed 3 years ago

RainNapper commented 4 years ago

Partial resolution of https://github.com/linkedin/bluepill/issues/424

Swap the repeat logic to run before we decide to minimize the simulators to match the bundle size.

If you were running with 10 sims, 1 test, 2 repeats, then the existing logic would cut your sims from 10 to 1, then duplicate bundles from 1 to 2. This left the repeats running in series.

In this change, this would duplicate bundles from 1 to 2, then cut sims from 10 to 2.

Some output of this run:

{84002} 20200407.130243 [  INFO  ] (BLUEPILL) Using xctestrun configuration
{84002} 20200407.130243 [  INFO  ] (BLUEPILL) This is Bluepill v5.2.0-1-g01c5147
{84002} 20200407.130243 [  INFO  ] (BLUEPILL) Packing test bundles based on test counts.
{84002} 20200407.130243 [  INFO  ] (BLUEPILL) Duplicating test bundles 1 time(s) for test repeats
{84002} 20200407.130243 [ WARNING] (BLUEPILL) Lowering number of parallel simulators from 10 to 2 because there aren't enough test bundles.
{84002} 20200407.130243 [  INFO  ] (BLUEPILL) Running with 2 parallel simulators.
{84002} 20200407.130243 [  INFO  ] (BLUEPILL) Packed tests into 2 bundles

Notice the timings indicate they are in fact running in parallel.

{84023} 20200407.130244 [  INFO  ] (BP-1) Running Tests. Attempt Number 1.
{84054} 20200407.130245 [  INFO  ] (BP-2) Running Tests. Attempt Number 1.
{84023} 20200407.130402 [ PASSED ] (BP-1)  50.217322s TestClass/TestName
{84054} 20200407.130406 [ PASSED ] (BP-2)  53.405522s TestClass/TestName

Also verified by running non-headless, and it showed multiple simulators running the same test in parallel.

I was not sure of a great way to test this since I did not see clear points of abstraction, or how to check the number of simulators running in an integration test. Please advise if you feel I should add tests.