You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Runs tests with test and code coverage results placed in provided results directory.
116
+
# Default results directory is "TestResults".
117
+
```
118
+
119
+
Other properties can be set alongside as needed.
120
+
121
+
### Running using Dotnet SDK (traditional)
122
+
123
+
#### Run Functional Tests
81
124
82
125
- Windows (`netfx x86`):
126
+
83
127
```bash
84
128
dotnet test"src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="Win32" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
85
129
```
86
130
87
131
- Windows (`netfx x64`):
132
+
88
133
```bash
89
134
dotnet test"src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="x64" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
90
135
```
91
136
92
137
- AnyCPU:
93
138
94
139
Windows (`netcoreapp`):
140
+
95
141
```bash
96
142
dotnet test"src\Microsoft.Data.SqlClient\tests\FunctionalTests\Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"
97
143
```
98
144
99
145
Unix (`netcoreapp`):
146
+
100
147
```bash
101
148
dotnet test"src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
102
149
```
103
150
104
-
## Run Manual Tests
151
+
#### Run Manual Tests
152
+
153
+
### Pre-Requisites for running Manual tests
105
154
106
-
### Pre-Requisites for running Manual tests:
107
155
Manual Tests require the below setup to run:
108
-
* SQL Server with enabled Shared Memory, TCP and Named Pipes Protocols and access to the Client OS.
109
-
* Databases "NORTHWIND" and "UdtTestDb" present in SQL Server, created using SQL scripts [createNorthwindDb.sql](tools/testsql/createNorthwindDb.sql) and [createUdtTestDb.sql](tools/testsql/createUdtTestDb.sql). To setup an Azure Database with "NORTHWIND" tables, use SQL Script: [createNorthwindAzureDb.sql](tools/testsql/createNorthwindAzureDb.sql).
110
-
* Make a copy of the configuration file [config.default.json](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json) and rename it to `config.json`. Update the values in `config.json`:
156
+
157
+
- SQL Server with enabled Shared Memory, TCP and Named Pipes Protocols and access to the Client OS.
158
+
- Databases "NORTHWIND" and "UdtTestDb" present in SQL Server, created using SQL scripts [createNorthwindDb.sql](tools/testsql/createNorthwindDb.sql) and [createUdtTestDb.sql](tools/testsql/createUdtTestDb.sql). To setup an Azure Database with "NORTHWIND" tables, use SQL Script: [createNorthwindAzureDb.sql](tools/testsql/createNorthwindAzureDb.sql).
159
+
- Make a copy of the configuration file [config.default.json](src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/config.default.json) and rename it to `config.json`. Update the values in `config.json`:
111
160
112
161
|Property|Description|Value|
113
162
|------|--------|-------------------|
@@ -130,36 +179,40 @@ Manual Tests require the below setup to run:
130
179
|IsAzureSynpase | (Optional) When set to 'true', test suite runs compatible tests for Azure Synapse/Parallel Data Warehouse. |`true` OR `false`|
131
180
|MakecertPath | The full path to makecert.exe. This is not required if the path is present in the PATH environment variable. |`D:\\escaped\\absolute\\path\\to\\makecert.exe`|
132
181
133
-
### Commands to run Manual Tests:
182
+
### Commands to run Manual Tests
183
+
184
+
- Windows (`netfx x86`):
134
185
135
-
- Windows (`netfx x86`):
136
186
```bash
137
187
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="Win32" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
138
188
```
139
189
140
-
- Windows (`netfx x64`):
190
+
- Windows (`netfx x64`):
191
+
141
192
```bash
142
193
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="x64" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
143
194
```
144
195
145
-
- AnyCPU:
196
+
- Windows (`netfx`):
146
197
147
-
Windows (`netfx`):
148
198
```bash
149
199
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetfx" --no-build -v n --filter "category!=nonnetfxtests&category!=failing&category!=nonwindowstests"
150
200
```
151
201
152
-
Windows (`netcoreapp`):
202
+
- Windows (`netcoreapp`):
203
+
153
204
```bash
154
205
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonwindowstests"
155
206
```
156
207
157
-
Unix (`netcoreapp`):
208
+
- Unix (`netcoreapp`):
209
+
158
210
```bash
159
211
dotnet test"src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Unixnetcoreapp" --no-build -v n --filter "category!=nonnetcoreapptests&category!=failing&category!=nonlinuxtests&category!=nonuaptests"
160
212
```
161
213
162
214
## Run A Single Test
215
+
163
216
```bash
164
217
dotnet test"src\Microsoft.Data.SqlClient\tests\ManualTests\Microsoft.Data.SqlClient.ManualTesting.Tests.csproj" -p:Platform="AnyCPU" -p:Configuration="Release" -p:TestTargetOS="Windowsnetcoreapp" --no-build -v n --filter "FullyQualifiedName=Microsoft.Data.SqlClient.ManualTesting.Tests.AlwaysEncrypted.CspProviderExt.TestKeysFromCertificatesCreatedWithMultipleCryptoProviders"
165
218
```
@@ -175,11 +228,12 @@ Tests can be built and run with custom "Reference Type" property that enables di
175
228
176
229
> ************** IMPORTANT NOTE BEFORE PROCEEDING WITH "PACKAGE" AND "NETSTANDARDPACKAGE" REFERENCE TYPES ***************
177
230
> CREATE A NUGET PACKAGE WITH BELOW COMMAND AND ADD TO LOCAL FOLDER + UPDATE NUGET CONFIG FILE TO READ FROM THAT LOCATION
178
-
> ```
231
+
>
232
+
> ```bash
179
233
> msbuild -p:configuration=Release
180
234
>```
181
235
182
-
### Building Tests:
236
+
### Building Tests with Reference Type
183
237
184
238
For .NET Core, all 4 reference types are supported:
`SqlDataReader` returns a `DBNull` value instead of an empty `byte[]`. To enable the legacy behavior, you must enable the following AppContext switch on application startup:
TLS 1.3 has been excluded due to the fact that the driver lacks full support. To enable OS preferences as before, enable the following AppContext switch on application startup:
@@ -271,14 +326,17 @@ For enhanced developer experience, we support debugging SqlClient on Linux from
271
326
This project is also included in `docker-compose.yml` to demonstrate connectivity with SQL Server docker image.
272
327
273
328
To run the same:
329
+
274
330
1. Build the Solution in Visual Studio
275
331
2. Set `docker-compose` as Startup Project
276
332
3. Run "Docker-Compose" launch configuration.
277
333
4. You will see similar message in Debug window:
334
+
278
335
```log
279
336
Connected to SQL Server v15.00.4023 from Unix 4.19.76.0
280
337
The program 'dotnet' has exited with code 0 (0x0).
281
338
```
339
+
282
340
5. Now you can write code in [Program.cs](/src/Microsoft.Data.SqlClient/tests/DockerLinuxTest/Program.cs) to debug SqlClient on Linux!
283
341
284
342
### Troubleshooting Docker issues
@@ -288,6 +346,7 @@ There may be times where connection cannot be made to SQL Server, we found below
288
346
- Clear Docker images to create clean image from time-to-time, and clear docker cache if needed by running `docker system prune` in Command Prompt.
289
347
290
348
- If you face `Microsoft.Data.SqlClient.SNI.dll not found` errors when debugging, try updating the below properties in the netcore\Microsoft.Data.SqlClient.csproj file and try again:
349
+
291
350
```xml
292
351
<OSGroup>Unix</OSGroup>
293
352
<TargetsWindows>false</TargetsWindows>
@@ -310,13 +369,14 @@ dotnet test <test_properties...> --collect:"XPlat Code Coverage"
310
369
311
370
## Run Performance Tests
312
371
313
-
### Running Performance test project directly:
372
+
### Running Performance test project directly
314
373
315
374
Project location from Root: `src\Microsoft.Data.SqlClient\tests\PerformanceTests\Microsoft.Data.SqlClient.PerformanceTests.csproj`
316
375
Configure `runnerconfig.json` file with connection string and preferred settings to run Benchmark Jobs.
317
376
318
-
```
377
+
```bash
319
378
cd src\Microsoft.Data.SqlClient\tests\PerformanceTests
320
379
dotnet run -c Release -f netcoreapp3.1|net5.0
321
380
```
381
+
322
382
_Only "**Release** Configuration" applies to Performance Tests_
0 commit comments