Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The following page has been changed by DavidPhillips: http://wiki.apache.org/hadoop/Hive/DeveloperGuide ------------------------------------------------------------------------------ == Unit tests == === Layout of the unit tests === - Hive uses junit for unit tests. Each of the 3 main components of Hive have their unit test implementations in the corresponding src/test directory e.g. trunk/metastore/src/test has all the unit tests for metastore, trunk/serde/src/test has all the unit tests for serde and trunk/ql/src/test has all the unit tests for the query processor. The metastore and serde unit tests provide the TestCase implementations for junit. The query processor tests on the other hand are generated using Velocity. The main directories under trunk/ql/src/test that contain these tests and the corresponding results are as follows: + Hive uses junit for unit tests. Each of the 3 main components of Hive have their unit test implementations in the corresponding src/test directory e.g. trunk/metastore/src/test has all the unit tests for metastore, trunk/serde/src/test has all the unit tests for serde and trunk/ql/src/test has all the unit tests for the query processor. The metastore and serde unit tests provide the !TestCase implementations for junit. The query processor tests on the other hand are generated using Velocity. The main directories under trunk/ql/src/test that contain these tests and the corresponding results are as follows: * Test Queries: * queries/clientnegative - This directory contains the query files (.q files) for the negative test cases. These are run through the CLI classes and therefore test the entire query processor stack. * queries/clientpositive - This directory contains the query files (.q files) for the positive test cases. Thesre are run through the CLI classes and therefore test the entire query processor stack. @@ -117, +117 @@ * results/compiler/parse - The expected Abstract Syntax Tree output for the queries in queries/positive. * results/compiler/plan - The expected query plans for the queries in queries/positive. * Velocity Templates to Generate the tests: - * templates/TestCliDriver.vm - Generates the tests from queries/clientpositive. + * templates/!TestCliDriver.vm - Generates the tests from queries/clientpositive. - * templates/TestNegativeCliDriver.vm - Generates the tests from queries/clientnegative. + * templates/!TestNegativeCliDriver.vm - Generates the tests from queries/clientnegative. - * templates/TestParse.vm - Generates the tests from queries/positive. + * templates/!TestParse.vm - Generates the tests from queries/positive. - * templates/TestParseNegative.vm - Generates the tests from queries/negative. + * templates/!TestParseNegative.vm - Generates the tests from queries/negative. === Tables in the unit tests === === Running unit tests === + Run all tests: + {{{ + ant test + }}} + + Run all positive test queries: + {{{ + ant test -Dtestcase=TestCliDriver + }}} + + Run a specific positive test query: + {{{ + ant test -Dtestcase=TestCliDriver -Dqfile=groupby1.q + }}} + + The about test produces the following files: + * {{{build/ql/test/TEST-org.apache.hadoop.hive.cli.TestCliDriver.txt}}} - Log output for the test. This can be helpful when examining test failures. + * {{{build/ql/test/logs/groupby1.q.out}}} - Actual query result for the test. This result is compared to the expected result as part of the test. + === Adding new unit tests === == Pluggable interfaces ==
