Skip to content

Provider compliance/test suite for ADO.NET #17004

Closed

Description

@roji

To promote standard behavior across ADO.NET providers, it would be great if a test suite existed. Ideally all provider-independent tests would be extracted from SqlClient and made available via a nuget. This would be similar to what the EF Core team has done.

Activity

  1. saurabh500 commented on Jul 19, 2016

    @saurabh500
    Contributor

    @roji
    Are you suggesting that we add tests based on System.Data.Common and these tests are used to test any ADO.Net providers by instantiating the actual provider objects?
    Can you point me to the EF tests that you are referring to?

  2. roji commented on Jul 19, 2016

    @roji
    MemberAuthor

    @saurabh500 yes, that's right. Providers such as Npgsql would extend test base classes provided by you, thus running your standardized test suite. Your tests would instantiate ADO.NET objects via the provider's DbProviderFactory and make sure that the provider's DbConnection, DbCommand, etc. behave as they should.

    For the EFCore provider test suite, see Microsoft.EntityFrameworkCore.Specification.Tests and Microsoft.EntityFrameworkCore.Relational.Specification.Tests. The source code is here and here respectively. A good example is QueryTestBase, which runs various query scenarios and makes sure the results come back as expected.

    It's true that ADO.NET is a mature technology which already has well-established providers, so such a "specification" test suite might be less valuable than in EFCore, which is totally new technology where providers can use the specification while implementing. But even with ADO.NET it would be very useful to automatically find divergences in provider behavior, leading to either standardized behavior or at least explicit documentation of those divergences.

  3. roji commented on Jul 19, 2016

    @roji
    MemberAuthor

    Note that Npgsql contains many tests which are completely generic - i.e. aren't specific to Npgsql/PostgreSQL in any way. It is exactly this kind of tests that belong in a provider-independent specification test library.

  4. saurabh500 commented on Nov 3, 2016

    @saurabh500
    Contributor

    @roji do you want to grab this task?

  5. roji commented on Nov 3, 2016

    @roji
    MemberAuthor

    @saurabh500 I have a lot on my plate, but I can try to spend some time on this (not right away though). Also, I'm pretty PostgreSQL-centric and will definitely need help with making sure things are portable.

  6. saurabh500 commented on Nov 3, 2016

    @saurabh500
    Contributor

    Sounds good.

  7. removed their assignment
    on Nov 3, 2016
  8. roji commented on Dec 21, 2016

    @roji
    MemberAuthor

    Just to say that I'm unlikely to find any time to work on this soon... Hopefully Microsoft (or someone else) can pick this up.

  9. divega commented on Aug 1, 2017

    @divega
    Contributor

    cc @bricelam what do you think about refactoring the Microsoft.Data.Sqlite test to follow the test spec pattern we already use for EF Core provider tests?

  10. bricelam commented on Aug 1, 2017

    @bricelam
    Contributor

    They weren't written with that purpose in mind, but it could be a good starting point since they're very functional in nature.

  11. divega commented on Aug 1, 2017

    @divega
    Contributor

    @bricelam I think that is probably true for (at least some of) the SqlClient tests.

  12. bgrainger commented on Nov 21, 2017

    @bgrainger
    Contributor

    This is something I've been interested in having for a while, too (as the author of MySqlConnector). I got tired of manually writing test cases to check compatibility across different drivers, so I created an automated test harness. 🙂

    A WIP rough draft is here: https://github.com/mysql-net/AdoNetApiTest

    I bootstrapped the prototype with @bricelam's SqliteCommand tests (which saved a lot of time, thanks!).

    Inspired by http://seriot.ch/json/parsing.html, it dumps output like the following. (Take the colours in the cells with a grain of salt; I haven't investigated them all to ensure that they're not caused by a bug in the test harness itself.)

    image

  13. roji commented on Nov 21, 2017

    @roji
    MemberAuthor

    @bgrainger that looks like a wonderful start - I'm excited to see this.

    Although I expect to be too busy until end of December, I definitely look forward to contributing to this and evolving it. In the meantime, please take a look at the Npgsql tests - a lot of them are exactly the kind of generic, functional tests that would fit perfectly into this.

    One more comment - while it's really useful for this to exist as a self-contained project that includes connectors to specific ADO.NET providers, it's also important that projects like Npgsql and MySqlConnector be able to use this in their solutions, and to override certain things. In other words, there will need to be a generic abstract nuget that specific ADO.NET drivers can consume, extending the abstract test suite. Some tests may be overridden (so everything needs to be virtual), some would be ignored/skipped (not relevant for that provider), etc. etc.

  14. bgrainger commented on Nov 21, 2017

    @bgrainger
    Contributor

    Thanks; that's a great suggestion (and I hadn't thought that far ahead yet...). Created mysql-net/AdoNetApiTest#3 to discuss it (without hijacking this issue).

  15. 23 remaining items

  16. added this to the Future milestone on Jan 31, 2020
  17. removed
    untriagedNew issue has not been triaged by the area owner
    on Jun 22, 2020
  18. dotnet-policy-service commented on Dec 23, 2024

    @dotnet-policy-service
    Contributor

    Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.

    This process is part of our issue cleanup automation.

  19. dotnet-policy-service commented on Jan 6, 2025

    @dotnet-policy-service
    Contributor

    This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.

  20. removed this from the Future milestone on Jan 6, 2025
  21. locked and limited conversation to collaborators on Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions