Skip to content

Port some UnitTests tests to UnitTests.Pralleizable #4282

@tig

Description

@tig

The UnitTests project takes upwards of 5 minutes to complete. We run it across 3 platforms as part of CI/CD and as a result makes workflows way too slow. We must make it faster.

UnitTests is intended just have tests that can't be parallelized because the tests in must rely on static/global state etc...

However, it contains a large number of poorly coded unit tests:

  • Some combine the testing of multiple things at once
  • Some duplicate other existing unit tests (in UnitTests and UnitTests.Parallelizable)
  • Some use [AutoInitShutdown], Application, and/or ConfigurtionManager incorrectly. Using these makes tests not be able to be run concurrently.
  • Some are unit tests, but poorly written such that one test tries to test multiple things.
  • Some are not actually unit tests, as they cover large areas of functionality, not discrete units of functionality. They are actually Integration Tests. For this Issue, we are NOT focusing on these.

To address this Issue we need to

  1. Identify the tests that are the biggest causes of poor performance of the project when run.

  2. Analyze all tests in UnitTests and UnitTests.Paralleizable and categorize them according to these buckets:

    a) Unit tests that must remain non-paralleizable,
    b) unit tests that combine multiple unit tests and should be broken apart (and potentially moved to UnitTests.Parallizable,
    c) unit tests that are duplicates,
    d) unit tests that are actually integration tests.

  3. Port, rewrite, refactor tests in buckets b and c into UnitTests.Parallizable that will have a big increase in test speed

I'm assigning this Issue to CoPilot to get it done. This should be a good set of work an AI can do.

Instructions to CoPilot:

  • Follow the coding standards of the project.
  • Follow the .NET unit test guidance https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices
  • Avoid using additional libraries or tools beyond what the project already uses. if you believe there is a far better tool, suggest it.
  • Study deeply the existing tests in UnitTests.Paralliazable to understand what can and can't be parrallized befor you begin. Also study the code for [AutoInitShutdown] and [SetupFakeDriver]
  • Follow the guidance in the parallelizable unit tests project's readme.md.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions