Skip to content
Unit test framework for hive and hive-service
Branch: master
Clone or download
edwardcapriolo Merge pull request #15 from alanzhao1/update-readme-maven-dependency
Update maven dependency declaration in readme
Latest commit 15d17d4 Jan 27, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Change identation Sep 9, 2014
.gitignore Merge changes with upstream Jul 29, 2014
pom.xml Merge changes to introduce support for Hive 0.11.0. Introduce fixes s… Mar 10, 2014

hive_test: A simple way to test Hive scripts.

Build Status


hive_test gives us an embedded Hive including an embedded Derby database, and a local HiveThriftService. This allows us to create unit tests very easily.

Hive scripts testing can be done in a similar way to PigUnit. For more examples check this class

        public void testScriptListInput() {
            Map<String, List<String>> input = Maps.<String, List<String>>newHashMap();
            List<String> lines = Lists.newArrayList();

            input.put("$INPUT1", lines);

            Response output =

            List<String> expected = Lists.newArrayList();

            assertEquals(ResponseStatus.SUCCESS, output.getResponseStatus());
            assertEquals(expected, output.getResult());


Available from Maven central

Declare the Maven dependency in your pom.xml file


Execution profiles

Without a local Hadoop install

By default, we're set to download a local copy of Hadoop when you first build Hive Test, or whenever the project is cleaned, just before running our test cases.

You can force a redownload and installation of Hadoop by manually activating the download-hadoop profile

mvn --activate-profiles download-hadoop test

You can also perform the download and extraction process independent of testing.

Download Hadoop (into the maven target directory)

mvn --activate-profiles download-hadoop wagon:download-single

Extract Hadoop (into the maven target directory)

mvn --activate-profiles download-hadoop exec:exec
With a local Hadoop install

We'll skip attempting to download and use a local copy of Hadoop if any of the following are true

  • set your HADOOP_HOME environment variable to a hadoop distribution
  • hadoop tar extracted to $home/hadoop/hadoop-0.20.2_local

Hive Test will work so long as you have Hadoop in your path, i.e. /usr/bin/hadoop. In this case, you'll want to deactivate the hadoop download.

mvn --activate-profiles -hadoop-home-defined test


Contributions are welcome! You can contribute by

  • starring this repo!
  • adding new features
  • enhancing existing code
  • testing
  • enhancing documentation
  • bringing suggestions and reporting bugs
  • spreading the word / telling us how you use it!
You can’t perform that action at this time.