Skip to content

Make Test conditions work in Visual Studio #3191

@Wraith2

Description

@Wraith2

When developing changes or investigating bugs in SqlClient it is important to be able to run the tests. This can be done from the commandline using complex syntax but most people prefer to be able to use the tests from inside visual studio. If try to run tests inside visual studio you will quickly discover that all tests run regardless of their conditions which means that even on a clean working master build you will wait a long time for test failures and have to sort through which failures are expected because they should not have been run.

A simple example is ConnectivityTest.ConnectionAliasTest. This is defined as:

        [PlatformSpecific(TestPlatforms.Windows)]
        [ConditionalFact(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsSQLAliasSetup))]
        public static void ConnectionAliasTest()

The test should not be executed unless it the IsSQLAliasSetup function returns true. I have not configured the alias, that function never returns true. The test is executed anyway.

I'd like to be able to run tests from inside visual studio and have any applied conditions correctly validated preventing tests that cannot succeed from being executed. Being able to evaluate whether the change i'm working on is breaking other parts of the library will enable much quicker testing allowing less reliance on the, no longer available to contributors, CI.

Metadata

Metadata

Assignees

Labels

Enhancement 💡Issues that are feature requests for the drivers we maintain.P3Use for tagging low priority issues, impacts a single customer, and is not a critical/high issue.Triage Done ✔️Issues that are triaged by dev team and are in investigation.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions