dotnet / dotnet/SqlClient

Make Test conditions work in Visual Studio

Open
#3,191 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
989
Forks
340
Avg merge
4d 19h
Merged PRs (30d)
72

Description

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:
```csharp
[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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.