Git Product home page Git Product logo

markdowndbunit's Introduction

markdownDbUnit

This repository is markdown's extension for DBUnit.

Motivation

Why I made markdown's extention? It is a simple reason. Markdown has high affinity with GitHub!!

GitHub supports markdown in high level.
If your project has many test data's files for testing and your service's enhancement will change the files drasticly, then, you want to see the differences betweens new and old files in review of pull request. Is it convinience to see the differences as follows!?

pullRequestDifferences

That's the reason!

Required

  • Java 7 or above

Usage

Maven

Add this repository and depenedency.
This dependency includes DBUnit, so you can now use DBUnit.

    <repositories>
        <repository>
            <id>markdownDbUnit</id>
            <url>https://raw.github.com/aha-oretama/markdownDbUnit/mvn-repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>aha-oretama.jp</groupId>
            <artifactId>markdownDbUnit</artifactId>
            <version>1.0.0-RC1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

If you want to use different version's DBUnit, exclude dependency and add dependency as follow.

    <dependencies>
        <dependency>
            <groupId>aha-oretama.jp</groupId>
            <artifactId>markdownDbUnit</artifactId>
            <version>1.0.0-RC1</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>org.dbunit</artifactId>
                    <groupId>dbunit</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        
        <dependency>
            <groupId>org.dbunit</groupId>
            <artifactId>dbunit</artifactId>
            <version>2.5.0</version>
        </dependency>
    </dependencies>

How to use

You can use like DBUnit. The usage of DBUnit is here.

Here is the example for clean, insert. The point is only using MarkdownDataSet.

  def setup() {
    IDatabaseTester databaseTester = new JdbcDatabaseTester(JDBC_DRIVER, JDBC_URL, USER, PASSWORD)
    IDatabaseConnection connection = databaseTester.getConnection()
    IDataSet dataSet = new MarkdownDataSet(new File(PATH))
    DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet)
  }

MarkDown Format

Markdown's table represents a database's table and data. A file can include multiple tables.

Support align columns feature.

# User
| user_id | first_name | last_name | gender | age | 
|---------| ----------- |:-------- | ----: |:---:|
| 00001 | hogehoge | taro | male | 20 |

# Score 
user_id | subject | score
------- | :-------: |:-----
00001 | Mathematics | 100

If columns which exit database's table are not written in markdown's table, the columns are treated as null. The columns written as null are also treated as null. Empty columns are treated as empty string.

Supoort

  • DBUnit 2.5.0 or above

I did not verify DBUnit version under 2.5.0, but I think it goes well.

markdowndbunit's People

Contributors

aha-oretama avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

markdowndbunit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.