waitingforhandle / dbunittester Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ivangeorgiev/dbunittester
Execute database unit tests or generate testing SQL using JDBC interface.
This project forked from ivangeorgiev/dbunittester
Execute database unit tests or generate testing SQL using JDBC interface.
DbUnitTester Database Unit Test Execution Tool ============================================== Copyright (c) 2012 Ivan Georgiev. All rights reserved. Prerequisites ------------- Bul7Lib - available as separate jar download. Getting Started --------------- 1. Installation You need to download following packages: DbUnitTester.jar lib/Bul7Lib.jar Make sure you place them in the directories denoted above. 2. Prepare Test Definition. The definition for tests is stored in json file. In this exacmple we are creating unit tests for database procedure that loads the PERSONS table. ---------------- persons.ut.json ------------------- { "executor": { "type": "SqlDump", }, "testcase": { name: "MyETLStaging", "testcases": [ { name: "PersonsStaging", "sources": [ { "name": "expect", "source": "fix_persons"}, { "name": "actual", "source": "persons", "filter": "person_id = 32" } ], "validators": [ { "name": "CountMatch", "type": "CountMatch", "expect": "expect", "actual": "actual" }, { "name": "DataMatch", "type": "ColByColDataMatch", "expect": "expect", "actual": "actual", "columns": "person_id,first_name,last_name", } ] } ] } } ---------------------------------------------------- 4. Dump interpreted definition Modify the persons.ut.java file. Modify the "executor" definition: "type": "Dump" Execute following command: java -jar DbUnitTester.jar persons.ut.json This will display the test definiton loaded by the tester. This technique is useful for debugging your definition. 3. Run the test Make sure you set the "executor" type back to the value above: "type": "SqlDump" Execute the following command: java -jar DbUnitTester.jar persons.ut.json > MyETLStaging_UnitTest.sql This will produce a file containing SQL statments that carry out the unit test cases described in your file. Extending DbUnitTester ---------------------- 1. Create custom executor. We showed you how you can use different executors to generate SQL and dump the test definition. You can create custom Java class that implements the extends the Executor class. Name it xxxExecutor. For example. Dump executor class is named DumpExecutor. Sql generator class is named SqlDumpExecutor. 2. Create custom validators
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.