Following are a few rules of thumb that should be followed when adding new test cases in Hive that require the introduction of new query file(s). Of course, these rules should not be applied if they invalidate the purpose of your test to begin with. These are generally helpful in keeping the test queries concise, minimizing the redundancies where possible, and ensuring that cascading failures due to a single test failure do not occur.
src
.SELECT
query, keep it as simple as possible, and minimize the number of queries to keep overall test time down; avoid repeating scenarios which are already covered by existing tests.SELECT
statement, make sure you use the ORDER BY
clause to minimize the chances of spurious diffs due to output order differences leading to test failures.DROP TABLE
directive to make sure that any upstream test failures that could not clean up do not cause your test to fail.DROP TABLE
directive to drop the table(s) you may have created during the course of the test.Adding new unit tests describes how to create positive and negative client tests and their output files.