A number of simple methods to test database objects and execute sql. Currently supports Microsoft SQL Server databases.


Keywords
database, testing, test, framework, mssql, sql, server, microsoft, unit, integration, helper, tdd, c#, acceptance, mstest, nunit, xunit, tester, db, vulcan, analytics, integration-testing, test-framework, unit-testing
License
GPL-3.0
Install
Install-Package VulcanAnalytics.DBTester -Version 1.0.0-beta5

Documentation

DBTester

NuGet

Changelog

License

Join the chat at https://gitter.im/VulcanAnalytics-DBTester/Lobby

What is DBTester?

DBTester is a testing framework library built to remove the need for database plumbing and repetitive code for performing utility actions from one test project to the next. Afterall why copy and paste the same database code from one project to the next, or worse still, write it out again?

This library is available through NuGet for immediate inclusion in your projects.

Further information to this README is available on the wiki

Ok, but what can I actually do with DBTester?

First, create an instance of DBTester with the MSSQL database you wish to interact with;

using VulcanAnalytics.DBTester;
var connectionstring = @"Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=tempdb;Integrated Security=SSPI;";
DatabaseTester tester = new MsSqlDatabaseTester(connectionstring);

Secondly, use one or more of the functions to interact with or check a condition from the database;

var schema = "dbo";
var table = "testtable";

var hasTable = tester.HasTable(schema, table);

Assert.IsTrue(hasTable);

And there we have it, no need to decide on how to use various other database libraries or SQL scripts, just one succint place to come to for database testing utilities.

This list of methods is short today, but increasing (as the database projects I'm currently working on requires further unit testing).

Where did this come from?

This project has been born of the experience I have had in writing the same code for database unit and user acceptance testing in MSTest and SpecFlow. DBTester marks the third generation of this effort (both of the previous generations were client's closed source implementations). In previous implementations there have been functionality for interacting with SQL Server Agent and SQL Server Integration Services revealing my background as a Business Intelligence and Data Warehousing Engineer.

Now where is it going?

My roadmap for DBTester is to work towards a minimally functional yet stable release for version 1.0.0.

A few of the key aspects to have in place are;

  • high test coverage of the library
  • continuous integration and delivery
  • clear documentation on the wiki
  • NuGet packaging
  • Abstract class to support extensions for other databases/techniques
  • Basic implementation of another database as proof of concept

Much of this is already in place via Microsoft DevOps (formally Visual Studio Team Services)

With this in place over the coming month or so (October 2018) - I would then be welcoming the idea of other contributors being involved.

Where can I get it?

First, install NuGet. Then, install DBTester from the package manager console:

PM> Install-Package VulcanAnalytics.DBTester

Do you have an issue?

If you're running into problems, please file an issue here on GitHub at the top of the page.

License, etc.

DBTester source code is Copyright © 2018 Darren Comeau and other contributors under the GNU GPLv3 License.

If you have any questions regarding the license please refer to this issue and feel free to get in touch.

My promise to you.

Here are a couple of notes about how this project will be maintained;

  • Bugs will always come first, when you report a bug it will be the priority. Hopefully that will mean a rapid bug fix release, else advice on a work around and an estimate for which release the fix will be in.
  • Semantic Versioning will be practiced religiously. You should always be confident that updating to the latest bug or minor release won't cause you an issue.
  • Release notes will include clear details of the changes based on Keep a Changelog.
  • Major releases will not be so frequent as to force you to keep reworking your own projects.
  • Major releases will also be supported with bug fixes and new minor features for as long as possible.