dbapi_test_suite 0.1.0-alpha.8
dbapi_test_suite: ^0.1.0-alpha.8 copied to clipboard
Test suite for dbapi backends
Test suite for the dbapi, a standardized interface abstracting database interaction, targeting both SQL and noSQL.
Getting started #
This library is intended for implementers of dbapi backends.
Start by implementing/extending the Connector abstract class.
This will require you to implement a Connection class, which in
turn will prompt the need for a Cursor.
Start by adding support for the AddCollection and Insert operations,
as those are required by almost all other tests.
As soon as you have a minimal implementation, you can start running it against the test suite by using the ConnectorTestSuite.
import 'package:dbapi/test_suite.dart';
import 'package:your_backend/your_backend.dart';
class YourDatabaseTest with ConnectorTestSuite<YourDatabaseTest> {
@override
YourDatabaseConnector get connector => YourDatabaseConnector(...);
}
void main() {
final testSuite = YourDatabaseTest();
testSuite.runDatabaseTests();
}
Once you fixed all the tests for the "core" set of features, you can
then gradually add more to your Connector.supportedFeatures set.
Additional information #
The test_suite is integral part of the API contract. If your database supports a feature but tests can pass you should document it clearly (and let us know, we might need to tweak the APIs!)
Contribution #
Contribution welcome, especially in the form of feedback on the API.