microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
878 stars 484 forks source link

Static test constructors cause slow perf and unnecessary changes #4802

Closed gabog closed 2 years ago

gabog commented 4 years ago

Version

4.10.x.

Describe the bug

When we refactored our tests to xUnit we moved some expensive logic to static constructors (e.g.: see SchemaMergeTests.cs.

VS Test Explorer executes these static constructors when attempting to enumerate the tests which recreates files and also starts the ComsbosDB emulator resulting in slow IDE performance.

For the case of tests.schema and tests.uischema, this may also change those files and the output may be different than what we have in git if you don't have the latest CLI version.

To Reproduce

Steps to reproduce the behavior:

  1. Open the solution in visual studio.
  2. Open the test explorer window
  3. While the tests are being discovered, you'll see CosmosDB starting up and you'll notice that tests.schema and tests.uischema are being updated (sometimes with different results based on the version of the CLI you are running)

Expected behavior

I would expect the schemas would only be updated if I am running tests related to schemas and that the CosmosDB and Azure Storage emulators would run only if I am running tests related to them.

Screenshots

If applicable, add screenshots to help explain your problem. image

Additional context

We should probably remove these static constructors and refactor the tests to use Class Fixtures or Collection Fixtures

See also XUnit comparison to MS Tests for more info the alternative for ClassInitialize

gabog commented 3 years ago

I need to work on some higher priority tasks, pushing this one to R13

mrivera-ms commented 3 years ago

Per discussion with @gabog, this is out of scope for R13.

tracyboehrer commented 2 years ago

We will not be addressing at the moment.