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 ZhengShao:
http://wiki.apache.org/hadoop/Hive/HowToContribute

------------------------------------------------------------------------------
    * Define methods within your class whose names begin with {{{test}}}, and 
call JUnit's many assert methods to verify conditions; these methods will be 
executed when you run {{{ant test}}}.
    * You can run all the unit test with the command {{{ant test}}}, or you can 
run a specific unit test with the command {{{ant -Dtestcase=<class name without 
package prefix> test}}} (for example {{{ant -Dtestcase=TestFileSystem test}}})
  
- == Understanding Ant ==
+ === Understanding Ant ===
  
  Hive is built by Ant, a Java building tool.  
  
   * Good Ant tutorial: http://i-proving.ca/space/Technologies/Ant+Tutorial
- 
- == Generating a patch ==
  
  === Unit Tests ===
  
@@ -68, +66 @@

  }}}
  and examining the HTML report in {{{build/test}}} might be helpful.
  
+ === Add a Unit Test ===
+ There are two kinds of unit tests in Hive:
+ 
+  * Normal unit test: These are used by testing a particular component of Hive.
+   * We just need to add a new class (name must start with "Test") in 
*/src/test directory.
+   * We can run "ant test -Dtestcase=TestAbc" where TestAbc is the name of the 
new class. This will test only the new testcase, which will be faster than "ant 
test" which tests all testcases.
+  * A new query: If the new feature can be tested using Hive command line, we 
just need to add a new *.q file and a new *.q.out file:
+   * If the feature is added in ql
+    * Add a new XXXXXX.q file in ql/src/test/queries/clientpositive
+    * Run "ant test -Dtestcase=TestCliDriver -Dqfile=XXXXXX.q -Doverwrite=true 
-Dtest.silent=false". This will generate a new XXXXXX.q.out file in 
ql/src/test/results/clientpositive.
+   * If the feature is added in contrib
+    * Do the steps above, replacing "ql" with "contrib", and "TestCliDriver" 
with "TestContribCliDriver".
+ 
  === Creating a patch ===
  Check to see what files you have modified with:
  {{{
@@ -76, +87 @@

  
  Add any new files with:
  {{{
- svn add src/.../MyNewClass.java
+ svn add .../MyNewClass.java
- svn add src/.../TestMyNewClass.java
+ svn add .../TestMyNewClass.java
+ svn add .../XXXXXX.q
+ svn add .../XXXXXX.q.out
  }}}
  
  In order to create a patch, type (from the base directory of hive):

Reply via email to