All Projects → Ninja-Squad → Dbsetup

Ninja-Squad / Dbsetup

An API for populating a database in unit tests

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Dbsetup

Faker
Faker is a pure Elixir library for generating fake data.
Stars: ✭ 673 (+254.21%)
Mutual labels:  database, test
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-1.05%)
Mutual labels:  database
Pyarango
Python Driver for ArangoDB with built-in validation
Stars: ✭ 183 (-3.68%)
Mutual labels:  database
Snowflake Connector Python
Snowflake Connector for Python
Stars: ✭ 185 (-2.63%)
Mutual labels:  database
Ormlite Jdbc
ORMLite JDBC functionality that works with JDBC drivers to attach to various database types
Stars: ✭ 184 (-3.16%)
Mutual labels:  database
Meilisearch
Powerful, fast, and an easy to use search engine
Stars: ✭ 20,236 (+10550.53%)
Mutual labels:  database
Django Sharding
A sharding library for Django
Stars: ✭ 184 (-3.16%)
Mutual labels:  database
Hitchhiker
a Restful Api test tool
Stars: ✭ 2,175 (+1044.74%)
Mutual labels:  test
Mysql
MySQL driver for Deno
Stars: ✭ 187 (-1.58%)
Mutual labels:  database
Choochoo
Training Diary
Stars: ✭ 186 (-2.11%)
Mutual labels:  database
Piladb
Lightweight RESTful database engine based on stack data structures
Stars: ✭ 184 (-3.16%)
Mutual labels:  database
Hive
Lightweight and blazing fast key-value database written in pure Dart.
Stars: ✭ 2,681 (+1311.05%)
Mutual labels:  database
Pdo
Connecting to MySQL in PHP using PDO.
Stars: ✭ 187 (-1.58%)
Mutual labels:  database
Dbdb.io
The On-line Database of Databases
Stars: ✭ 184 (-3.16%)
Mutual labels:  database
Couchbase Lite Core
Cross-platform C++ core library for Couchbase Lite
Stars: ✭ 187 (-1.58%)
Mutual labels:  database
Pssqlite
PowerShell module to query SQLite databases
Stars: ✭ 184 (-3.16%)
Mutual labels:  database
Loudml
Loud ML is the first open-source AI solution for ICT and IoT automation
Stars: ✭ 185 (-2.63%)
Mutual labels:  database
Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Stars: ✭ 15,172 (+7885.26%)
Mutual labels:  database
Simple Crud
PHP library to provide magic CRUD in MySQL/Sqlite databases with zero configuration
Stars: ✭ 190 (+0%)
Mutual labels:  database
Condenser
Condenser is a database subsetting tool
Stars: ✭ 189 (-0.53%)
Mutual labels:  database

CircleCI

Overview

DbSetup allows populating a database before executing automated integration tests (typically, DAO/Repository automated tests). Although DBUnit, which is a great project, allows doing the same thing and much more, it's also harder to use and setup. And in our experience, in 98% of the cases, DBUnit is only used to pre-populate a database before executing every test method. This is the task on which DbSetup concentrates.

The philosophy of DbSetup is that DAO tests should not have to setup the database, execute tests, and then remove everything from the database. Instead, a single setup method should be used to delete everything from the database (whatever the previous test put in it, or the initial state of the database tables), and then populate it with the data necessary to execute the test.

Another design choice of DbSetup is to provide an easy to use and simple Java API to populate the database, rather than loading data from external XML files. Using a Java API has several advantages:

  • It allows using real Java types as data (longs, enums, etc.)
  • It allows defining default values, looping to generate several similar rows, storing data sets in variables or factorizing their creation using resusable methods
  • It allows viewing the data sets easily, without having to open external files, by storing the data set directly into the test class, or by navigating through classes and methods using the IDE shortcuts.
  • For more complex situations, like cyclic referential integrity constraints between rows, the Java API allows easily integrating SQL statements into the sequence of operations to execute to pre-populate the database. These SQL statements can, for example, disable constraints and re-enable them.

Documentation

The documentation is available at dbsetup.ninja-squad.com. It's hosted by github, from the gh-pages branch.

Bugs and RFEs

To submit bugs or RFEs, use Github.

How to...

build

./gradlew build

install the artifacts in your own local Maven repository

./gradlew publishToMavenLocal

release a new version of DbSetup

  • Make sure you have a file named gradle.properties under HOME/.gradle, and this file contains the following properties:

     sonatypeUsername=<the sonatype user name>
     sonatypePassword=<the sonatype password>       
     signing.keyId=<the ID of the PGP key to use>
     signing.password=<the password used to protect your PGP key configured in the ninjasquad bintray account>
     signing.secretKeyRingFile=<the path to the secring.jpg file>
    
  • Make sure the version of DbSetup in the project's gradle.properties file is the right one. It must not end with -SNAPSHOT

  • Execute

     ./gradlew clean build publishToSonatype closeAndReleaseSonatypeStagingRepository
    

That should create a new staging repo in Sonatype OSSRS, then upload the artefacts to this staging repo, sign close the repo and release (i.e. sync it to Maven central).

To only close the repo to test without syncing to Maven central, run

./gradlew clean build publishToSonatype closeSonatypeStagingRepository

Note: to check the jar file and pom publication before uploading, you can use

./gradlew publishMavenPublicationToBuildRepository

which will simply publish under the build/repo directory of the root project.

See the publishing guide at https://github.com/rwinch/gradle-publish-ossrh-sample.

License

DbSetup is released under the MIT License.

The MIT License

Copyright (c) 2012-2013, Ninja Squad

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].