Return-Path: X-Original-To: apmail-tajo-dev-archive@minotaur.apache.org Delivered-To: apmail-tajo-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DA6BF10F82 for ; Mon, 6 Jan 2014 05:54:07 +0000 (UTC) Received: (qmail 79732 invoked by uid 500); 6 Jan 2014 05:53:56 -0000 Delivered-To: apmail-tajo-dev-archive@tajo.apache.org Received: (qmail 79671 invoked by uid 500); 6 Jan 2014 05:53:51 -0000 Mailing-List: contact dev-help@tajo.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.incubator.apache.org Delivered-To: mailing list dev@tajo.incubator.apache.org Received: (qmail 79551 invoked by uid 99); 6 Jan 2014 05:53:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jan 2014 05:53:46 +0000 X-ASF-Spam-Status: No, hits=-2000.1 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 06 Jan 2014 05:53:43 +0000 Received: (qmail 76120 invoked by uid 99); 6 Jan 2014 05:52:51 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jan 2014 05:52:51 +0000 Date: Mon, 6 Jan 2014 05:52:50 +0000 (UTC) From: "Hyunsik Choi (JIRA)" To: dev@tajo.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (TAJO-476) Add a test development kit for unit tests based on executions of queries MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TAJO-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13862776#comment-13862776 ] Hyunsik Choi edited comment on TAJO-476 at 1/6/14 5:52 AM: ----------------------------------------------------------- I'm testing the utility proposed in TAJO-478. It uploaded a wrong patch for TAJO-476. So, I've deleted the wrong patch. was (Author: hyunsik): Updated the review request against branch master in reviewboard > Add a test development kit for unit tests based on executions of queries > ------------------------------------------------------------------------ > > Key: TAJO-476 > URL: https://issues.apache.org/jira/browse/TAJO-476 > Project: Tajo > Issue Type: Improvement > Reporter: Hyunsik Choi > Assignee: Hyunsik Choi > Fix For: 0.8-incubating > > Attachments: TAJO-476.patch, TAJO-476_20140106_14:50:26.patch > > > Relational algebra has numerous combinations, so SQL queries also have numerous cases that we can't figure out. One nice way of various ways to make and keep Tajo stable is to add lots of unit tests that cover many cases. > In many unit tests, we use front-end tests which execute SQL queries and verify their results. So far, we have implemented Java code to verify them. I think that its productivity is bad. It finally make us lazy to add various cases. > This patch adds QueryCaseTestBase class to help developers to add unit tests with little effort. QueryTestCaseBase provides useful methods to easily execute queries and verify their results. > It uses four resource directories: > * src/test/resources/dataset - contains a set of data files. It contains sub directories, each of which corresponds each test class. All data files in each sub directory can be used in the corresponding test class. > * src/test/resources/queries - This is the query directory. It contains sub directories, each of which corresponds each test class. All query files in each sub directory can be used in the corresponding test class. > * src/test/resources/results - This is the result directory. It contains sub directories, each of which corresponds each test class. All result files in each sub directory can be used in the corresponding test class. > For example, if you create a test class named TestJoinQuery, you should create a pair of query and result set directories as follows: > {noformat} > src-| > |- resources > |- dataset > | |- TestJoinQuery > | |- table1.tbl > | |- table2.tbl > | > |- queries > | |- TestJoinQuery > | |- TestInnerJoin.sql > | |- table1_ddl.sql > | |- table2_ddl.sql > | > |- results > |- TestJoinQuery > |- TestInnerJoin.result > {noformat} > QueryTestCaseBase basically provides the following methods: > * executeQuery() - executes a corresponding query and returns an ResultSet instance > * executeQuery(String fileName) - executes a given query file included in the corresponding query file in the current class's query directory > * assertResultSet() - check if the query result is equivalent to the expected result included in the corresponding result file in the current class's result directory. > * cleanQuery() - clean up all resources > * executeDDL() - execute a DDL query like create or drop table. > In order to make use of the above methods, query files and results file must be as follows: > * Each query file must be located on the subdirectory whose structure must be src/resources/queries/$\{ClassName\}, where $\{ClassName\} indicates an actual test class's simple name. > * Each result file must be located on the subdirectory whose structure must be src/resources/results/$\{ClassName\}, where $\{ClassName\} indicates an actual test class's simple name. > Especially, executeQuery() and assertResultSet(ResultSet) methods automatically finds a query file to be executed and a result to be compared, which are corresponding to the running class and method. For them, query and result files must additionally comply the followings: > * Each result file must have the file extension '.result' > * Each query file must have the file extension '.sql'. -- This message was sent by Atlassian JIRA (v6.1.5#6160)