https://github.com/hkoosha/huter
Hive Unit TEst Runner, SQL-only unit testing for hive
https://github.com/hkoosha/huter
hive hql sql unit-testing
Last synced: over 1 year ago
JSON representation
Hive Unit TEst Runner, SQL-only unit testing for hive
- Host: GitHub
- URL: https://github.com/hkoosha/huter
- Owner: hkoosha
- License: apache-2.0
- Created: 2021-11-13T11:24:19.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-25T14:58:47.000Z (over 2 years ago)
- Last Synced: 2025-01-28T15:40:49.495Z (over 1 year ago)
- Topics: hive, hql, sql, unit-testing
- Language: Java
- Homepage:
- Size: 194 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# huter
**H**ive **U**nit **TE**st **R**unner
SQL-only unit test framework for Hive!
### Direct Runner
Runs a single hive test, from arguments provided on the cli.
### Repo Runner
Runs tests in a hive repository of scripts.
The idea is to have the least amount of impact on the SQL scripts themselves. Although the default runner expects a
certain structure imposed on the script files and the directories they reside in, you can implement your Runner,
adapted to your desired directory structure.
Huter follows the usual testing frameworks structure (e.g. junit), thus we have:
1. Framework guiding points.
2. Unit to be tested.
3. Test cases.
4. Mocked environment.
5. Test data.
6. Unit evaluation.
7. Assertions.
These elements can be laid out like the following, with their number from list above denoted in front of them:
```
├── co_myCoordinator
│ └── wf_myWorkflow
│ └── the_script_being_tested.hql # Your script, who we want to test.
├── tables # Table definitions for Hive, by default expected in "tables" dir.
│ ├── sample_table_0.hql
│ └── sample_table_1.hql
└── test/ # 1, framework guiding point.
└── co_myCoordinator/ # 1
└── wf_myWorkflow/ # 1
└── the_script_being_tested.hql/ # 2, the unit, it's path under "test/" matches the script's path.
├── testRejectionOfDuplicates/ # 3, test case.
│ ├── parameters.ini # 4, mock env.
│ ├── setup.hql # 5, test data.
│ ├── test_0.hql # 7, assertions.
│ └── test_1.hql # 7
├── testSomethingElse/ # 2
│ └── test_0.hql # 7
├── parameters.ini # 4
├── setup.hql # 5
└── dependencies.txt # 4
```
Any script prefix with `test_` and suffixed with '.hql' will be treated as a test case.