Repository navigation
AOT 3: Move authentication registration to an AOT-safe Abstractions registry - #4821
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Fatal constructor failures can be swallowed, trimming guidance is inaccurate, and the new switch lacks default-value coverage.
3 open findings
What changed in this PR
Relocates authentication registration and initialization into Abstractions, removing the driver reflection bridge while preserving compatibility through type forwarding.
Changes:
- Adds an AOT-aware provider registry, feature switches, diagnostics, and localized resources.
- Forwards
SqlAuthenticationInitializerand routes driver lookups through the public registry. - Expands authentication tests and documentation.
| File | Description |
|---|---|
src/Microsoft.Data.SqlClient/tests/UnitTests/TypeForwardTests.cs |
Tests initializer forwarding. |
src/Microsoft.Data.SqlClient/tests/UnitTests/Microsoft/Data/SqlClient/EnableAppConfigSwitchTest.cs |
Removes relocated configuration test. |
src/Microsoft.Data.SqlClient/tests/FunctionalTests/AADAuthenticationTests.cs |
Updates registry documentation. |
src/Microsoft.Data.SqlClient/tests/AuthenticationTests/ConfigurationTest/Program.cs |
Verifies relocated initialization. |
src/Microsoft.Data.SqlClient/src/TypeForwards.Abstractions.cs |
Forwards initializer type. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.zh-Hant.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.zh-Hans.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.tr.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ru.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.pt-BR.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.pl.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ko.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.ja.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.it.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.fr.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.es.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs |
Removes moved resource accessors. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.de.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/Resources/Strings.cs.resx |
Removes moved authentication strings. |
src/Microsoft.Data.SqlClient/src/PackageReadme.md |
Documents registry relocation and AOT behavior. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlUtil.cs |
Removes relocated exception factories. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlAuthenticationProviderManager.cs |
Removes driver-owned registry. |
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Connection/SqlConnectionInternal.cs |
Uses the public provider registry. |
src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.cs |
Removes relocated initializer declaration. |
src/Microsoft.Data.SqlClient.Extensions/Azure/test/WamBrokerTests.cs |
Updates registry references. |
src/Microsoft.Data.SqlClient.Extensions/Azure/test/DefaultAuthProviderTests.cs |
Updates bootstrap test context. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/SqlAuthenticationProviderTest.cs |
Tests direct registration without the driver. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/ExceptionHelpersTest.cs |
Tests fatal-exception classification. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AzureProviderConstructionTest.cs |
Moves Azure construction tests. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AuthenticationStringsTest.cs |
Tests resilient message formatting. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AuthenticationRegistryTest.cs |
Tests registry callbacks and failures. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/test/AuthenticationFeatureSwitchesTest.cs |
Tests switch caching. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/TrimmingAttributes.cs |
Adds netstandard annotation polyfills. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProviderRegistry.cs |
Implements registry and bootstrap. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProvider.Internal.cs |
Removes the reflection bridge. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationProvider.cs |
Delegates directly to the registry. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/SqlAuthenticationInitializer.cs |
Defines the relocated public type. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.zh-Hant.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.zh-Hans.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.tr.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ru.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.resx |
Adds neutral authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.pt-BR.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.pl.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ko.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.ja.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.it.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.fr.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.es.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.de.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Resources/Strings.cs.resx |
Adds localized authentication strings. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/PackageReadme.md |
Documents registration and trimming. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/ExceptionHelpers.cs |
Classifies recoverable exceptions. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AuthenticationStrings.cs |
Implements localized error formatting. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/AuthenticationFeatureSwitches.cs |
Adds cached authentication switches. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/src/Abstractions.csproj |
Adds net10 and AOT analysis. |
src/Microsoft.Data.SqlClient.Extensions/Abstractions/doc/SqlAuthenticationProvider.xml |
Documents new registry behavior. |
BUILDGUIDE.md |
Documents targets and tests. |
.github/instructions/features.instructions.md |
Documents authentication switches. |
.github/instructions/architecture.instructions.md |
Records the new ownership model. |
Files not reviewed (1)
- src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Generated file
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4821 +/- ##
==========================================
- Coverage 73.61% 70.48% -3.14%
==========================================
Files 313 312 -1
Lines 45730 69158 +23428
==========================================
+ Hits 33666 48743 +15077
- Misses 12064 20415 +8351
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
The AOT guards do not automatically disable reflection, and wrapped fatal bootstrap errors can be suppressed.
4 open findings
Files not reviewed (1)
- src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Generated file
🧠 Review effort: Balanced
e3b1eb7 to
92c8049
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The package documentation incorrectly claims trimming and NativeAOT automatically disable reflective bootstrap paths.
4 open findings
Files not reviewed (1)
- src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Generated file
🧠 Review effort: Balanced
92c8049 to
0464451
Compare
cheenamalhotra
left a comment
There was a problem hiding this comment.
Please keep this PR focused on making authentication registration AOT-safe. I found below changes that affect existing behavior beyond that fix:
| # | Issue | Existing behavior affected | Requested change |
|---|---|---|---|
| 1 | Failed configured providers can silently fall back to Azure defaults | An initializer/provider activation failure stopped authentication and surfaced its cause. The new path traces the failure and can use a default provider instead of the explicitly configured provider. | Do not fill a failed explicit provider entry with an Azure default. Preserve the activation cause in the connection failure. Recovery for unrelated methods can remain. |
| 2 | Trimming unconditionally removes auth configuration and Azure discovery | A trimmed JIT app could retain the required types and use these paths. The new guards remove them even when their switches are enabled. | Preserve an enabled path for trimmed JIT apps that retain the required types. Keep publish-time switches for removing reflection and the AOT-safe explicit registration path. Report appropriate warnings when reflective paths remain enabled. |
| 3 | Replacement callbacks can deadlock registry lookups | Previously, callbacks ran outside dictionary locks. Now a callback holding _sync can wait for another thread calling GetProvider, which waits for the same lock. |
Run BeforeLoad/BeforeUnload outside the global registry lock, while preserving thread-safe publication and lookup. |
For item 1, please preserve the connection-level failure behavior rather than blanket-rethrowing from public GetProvider; its previous reflection wrapper returned null on invocation failure.
Move provider registration, lookup and initialization into Extensions.Abstractions while preserving the driver's public API through type forwarding. Keep configuration and initializer precedence, replacement callbacks, and diagnostic failure handling. Guard reflective configuration and optional Azure discovery for trimming and Native AOT, and cover registry behavior, bootstrap, discovery, feature switches and type forwarding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allow explicit provider registration and lookup after recoverable bootstrap failure while preserving configuration precedence. Improve Azure contract upgrade traces and missing-provider guidance without adding a diagnostics API. Add recovery, connection-error, switch and test-isolation coverage, and document compatibility considerations in package readmes and API guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve connection metadata and trace-only bootstrap diagnostics, cover Open and OpenAsync with simulated-server regressions, and document authentication compatibility changes in package readmes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove obsolete string-schema failure cases now covered by the parent's relaxed parsing tests. Retain provider-collection validation coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove obsolete failure expectations superseded by the parent's provider-schema recovery coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Filter optional authentication assembly binding failures through the existing nested-fatal recoverability check. Exercise production Assembly.Load resolution for recoverable and fatal FileNotFoundException, FileLoadException, and BadImageFormatException failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Trace and skip recoverable initializer and provider failures while continuing later configuration entries and enabled Azure discovery. Preserve valid options and configuration precedence, and retain fatal activation errors. Correct Azure options-contract upgrade guidance to 7.0.2, document the compatibility behavior, and add unit and real-Azure discovery coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Forward Abstractions test reference mode and version arguments, prepare Logging in Package mode, and cover orchestration with regression tests. Clarify diagnostic timing and recovery behavior in authentication XML docs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain failed explicit registrations without falling back to defaults, allow application recovery, and execute callbacks outside the registry lock with publication revalidation. Preserve enabled reflective paths for trimmed JIT applications and cover recovery and concurrency behavior. Move the detailed compatibility analysis to the ADO.Net wiki and remove it from package readmes. Keep release-note updates separate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The new test incorrectly expects blocked provider defaults to be registered and will fail, while the error message incorrectly states that discovery is unavailable in all trimmed applications.
2 open issues
Review effort: Balanced
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The error message incorrectly states that discovery is unavailable in all trimmed applications, misleading users of the supported trimmed-JIT path instead of distinguishing its reflection-preservation requirements from NativeAOT’s explicit-registration guidance.
2 open issues
Review effort: Balanced
Clarify publish-time discovery removal, trimmed JIT preservation requirements, and NativeAOT explicit registration guidance. Add regression assertions for all Entra authentication methods. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Cross-assembly authentication ownership, public type relocation, and bootstrap precedence changes require maintainer compatibility review and Windows/.NET Framework and trimmed/NativeAOT runtime validation that could not be performed in this environment.
1 open issue
1 resolved since last review
Review effort: Balanced
benrr101
left a comment
There was a problem hiding this comment.
How many times do I gotta approve this? 😂
There was a problem hiding this comment.
🔵 Needs a closer look
Authentication ownership and bootstrap changes span multiple assemblies, with unresolved breaking-change analysis and deferred compatibility, signed Windows, and trimming/NativeAOT validation beyond this static review.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Resolve test-signing documentation overlap while retaining Abstractions guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The missing registry diff and unresolved authentication ownership, bootstrap precedence, and concurrency concerns require maintainer review and .NET Framework plus trimmed/NativeAOT validation.
No open issues 🎉
Review effort: Balanced
N+1 times, it seems... Merged main to resolve conflicts and your approvals were reset 😿 |



Description
Move authentication registration and bootstrap into
Microsoft.Data.SqlClient.Extensions.Abstractions, enabling directSqlAuthenticationProvider.GetProvider/SetProvidercalls without loading the driver through reflection. Explicit provider registration is available in trimmed and Native AOT applications when both reflective bootstrap paths are disabled at publish time.Capabilities and API ownership
SqlAuthenticationInitializerinto Abstractions and forward its existing driver type reference.net10.0Abstractions asset alongsidenet462andnetstandard2.0.Switch.Microsoft.Data.SqlClient.EnableAppConfigandSwitch.Microsoft.Data.SqlClient.EnableAzureExtensionDiscovery, both default-enabled and cached on first access. Authentication configuration loading is switch-controlled on both .NET Framework and modern .NET; the driver's separate retry/switch-override readers remain modern-.NET-only.Package and ownership relationships
Solid arrows show compile-time references or direct calls; dashed arrows show type forwarding or optional reflective loading.
flowchart TB App["Application / custom authentication provider"] subgraph Driver["Microsoft.Data.SqlClient"] Forwarders["Authentication type forwarders"] Connection["SqlConnectionInternal<br/>provider-based token acquisition"] Attestation["Independent Azure attestation loader"] end subgraph Abstractions["Microsoft.Data.SqlClient.Extensions.Abstractions"] API["SqlAuthenticationProvider<br/>GetProvider / SetProvider"] Types["Authentication contracts<br/>including SqlAuthenticationInitializer"] Registry["SqlAuthenticationProviderRegistry<br/>shared providers + registration tiers"] Config["SqlAuthenticationConfiguration<br/>load and validate settings"] Bootstrap["Switch-controlled configuration activation<br/>and Azure discovery"] AuthLoader["Authentication Azure loader<br/>owned by Abstractions"] end subgraph Azure["Microsoft.Data.SqlClient.Extensions.Azure (optional)"] AzureProvider["ActiveDirectoryAuthenticationProvider"] Validator["Azure attestation validator"] end App -->|"GetProvider / SetProvider"| API App -->|"implements / uses"| Types Forwarders -.->|"forward existing type references"| API Forwarders -.-> Types Connection -->|"GetProvider"| API API --> Registry Registry --> Bootstrap Bootstrap --> Config Bootstrap --> AuthLoader AuthLoader -.->|"discover and construct defaults"| AzureProvider Attestation -.->|"load for attestation only"| Validator AzureProvider -->|"implements contracts; references Abstractions"| Types Connection -->|"AcquireTokenAsync on selected provider"| TypesProvider lookup and connection failures
sequenceDiagram participant Caller as Application or SqlConnectionInternal participant API as SqlAuthenticationProvider (Abstractions) participant Registry as Shared registry Caller->>API: GetProvider(method) API->>Registry: GetProvider(method) Registry->>Registry: EnsureBootstrapped() Note over Registry: Short state locks, configuration and callbacks run outside the lock alt Unexpected recoverable bootstrap failure, including cached failure Registry->>Registry: Trace failure and continue lookup else Completed or concurrent/reentrant bootstrap Note over Registry: Continue with currently published registrations end Registry->>Registry: Under short lock, inspect registration and retained failures alt Failed explicit method, or default blocked by initializer failure Registry-->>API: null else Usable registration Registry-->>API: Published provider else No registration Registry-->>API: null end API-->>Caller: Provider or nullRecoverable configuration failures are traced while later configured entries and enabled Azure discovery are still attempted. A failed explicit method is reserved against old/default-provider fallback. A failed initializer blocks defaults for otherwise-unregistered methods because its intended methods are unknown; successful explicit registrations remain usable. Successful application registration can recover a failed method without clearing failures for other methods.
Concurrent or reentrant calls during bootstrap do not wait for configuration callbacks: they see the state already published, potentially including a null result for a method not initialized yet. Normal/recoverable bootstrap completion is one-time; correcting configuration requires a restart to retry that bootstrap. Fatal bootstrap failures propagate and are not cached by the registry; later access can retry if execution continues.
For provider-based connection authentication, a missing provider without an
AccessTokenCallbackproduces aSqlExceptionfromOpen/OpenAsync. The message gives registration, package/discovery and tracing guidance. Detailed activation causes are retained/traced inside Abstractions, not attached as the connection exception's inner exception.Registration precedence and callbacks
sequenceDiagram participant App as Application / configured initializer participant Registry as Shared registry participant Old as Existing provider participant New as Incoming provider App->>Registry: SetProvider(method, provider) Registry->>Registry: EnsureBootstrapped() Registry->>Registry: Reject null provider Registry->>New: IsSupported(method), outside lock New-->>Registry: true required loop Until publication succeeds or precedence refuses Registry->>Registry: Short lock: snapshot registration, failure and precedence alt Default blocked by retained failure, or higher precedence exists Registry-->>App: false else Registration permitted opt Replacing an existing registration Registry->>Old: BeforeUnload(method), outside lock Registry->>Registry: Short lock: recheck registration identity Note over Registry: Restart the loop if the entry changed Registry->>New: BeforeLoad(method), outside lock end Registry->>Registry: Short lock: revalidate entry and failure state, then publish Note over Registry: Restart the loop if validation detects a change end end Registry-->>App: true after successful publicationSuccessful configuration registrations take precedence over application registrations, which take precedence over discovered defaults. Only registrations made synchronously on the configured initializer's own thread during
Initialize()receive configuration precedence; constructor-time and other-thread work use ordinary application precedence. Explicit configured provider entries are applied after the initializer.Replacement invokes the existing provider's
BeforeUnloadand the incoming provider'sBeforeLoadbefore publication. First insertion invokes neither callback. User callbacks run outside the registry lock and may overlap or repeat when concurrent/reentrant publication changes the entry. Publication revalidates registration identity and retained failure state rather than relying on provider equality.Ordinary application registration returns
falsefor null/unsupported providers and recoverable callback errors without publishing the failing candidate. Registration errors on the configured initializer's own thread escape to that initializer; configuration application traces recoverable failures and continues with subsequent entries. Fatal exceptions propagate. Callback side effects and earlier successful publications are not rolled back.First-access bootstrap and trimming/AOT boundaries
flowchart TD Entry["EnsureBootstrapped"] --> State["Short lock: inspect cached failure and bootstrap state"] State --> Cached{"Unexpected recoverable<br/>failure cached?"} Cached -->|"Yes"| Rethrow["Rethrow internally<br/>public Get/Set trace and continue"] Cached -->|"No"| Busy{"Completed or bootstrap<br/>already in progress?"} Busy -->|"Yes"| Return["Return to registry operation"] Busy -->|"No"| Start["Mark in progress; release lock"] Start --> ConfigGate{"EnableAppConfig?"} ConfigGate -->|"Yes"| Config["Read configuration and run initializer<br/>outside registry lock"] Config --> Entries["Attempt configured providers in order<br/>retain method-specific activation failures"] ConfigGate -->|"No"| AzureGate{"EnableAzureExtensionDiscovery?"} Entries --> AzureGate AzureGate -->|"Yes"| Discover["Discover Azure using options contract<br/>fill only eligible unregistered methods"] AzureGate -->|"No"| Done["Short lock: mark bootstrap completed"] Discover --> Done Config -.->|"Recoverable initializer failure"| InitFailure["Retain initializer failure; trace<br/>continue configured entries"] InitFailure --> Entries Config -.->|"Recoverable configuration-read failure"| ReadFailure["Trace; continue enabled discovery"] ReadFailure --> AzureGate Discover -.->|"Recoverable discovery failure"| DiscoveryFailure["Trace; retain earlier publications"] DiscoveryFailure --> Done Done --> ReturnThe configuration loader retains relaxed parsing: missing sections are valid;
ConfigurationErrorsExceptionis traced and produces empty settings without a legacy retry. Invalid optional settings do not discard other valid settings. Configuration/provider callbacks do not execute under the bootstrap-state lock.For explicit registration in trimmed or Native AOT applications, disable both reflective paths at publish time, then construct and register each required provider before opening connections:
Setting a switch only at runtime does not remove code at publish time. Enabling reflection does not root its required contracts. Trimmed JIT applications retaining those paths must preserve the relevant configuration infrastructure, constructors and discovered Azure option members. Enabled reflective paths report trimming warnings and, for Native AOT, dynamic-code warnings.
Public API and behavioral compatibility
TBD. Paul and Cheena will discuss and complete this section.
Issues
Related follow-up: #4817 covers the executable current/legacy app.config compatibility harness, which is not included in this layer. Relevant release-note compatibility details will be handled separately.
Testing