[ 
https://issues.apache.org/jira/browse/PHOENIX-1295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14152888#comment-14152888
 ] 

Gabriel Reid commented on PHOENIX-1295:
---------------------------------------

{quote}Maybe we should sort the results (post query execution)?{quote}

Yes, there are actually to verification methods: {{verifyQueryResults}}, which 
checks the result of the query without taking order into account (using a 
MultiSet), and {{verifyQueryResultsOrdered}}, which verifies that the results 
came out in exactly the same order as specified.

I've had to put this (as well as a few other tickets) on the back burner for a 
few days, but I'll try to get the query plan verification in there really soon.

> Add testing utility for table creation, population, and checking query results
> ------------------------------------------------------------------------------
>
>                 Key: PHOENIX-1295
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1295
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Gabriel Reid
>         Attachments: PHOENIX-1295-WIP1.patch
>
>
> Mostly due to the way the JDBC is structured in general, it's relatively 
> painful to create a simple test case that just creates a simple table, 
> populates it with a couple of rows, and checks the output of a query.
> Adding to this is the fact that there isn't really a single "right way" to 
> write simple unit tests in Phoenix. Some tests try to cleanly close 
> statements, ResultsSets, and Connections, while others don't. New tests of 
> this sort are often created by first copying an existing test.
> The end results is that a couple of simple test cases to test a new built-in 
> function often end up being mostly wresting with JDBC, with the actual test 
> case getting largely hidden in the noise.
> The purpose of this ticket is to propose a utility to simplify creating 
> tables, populating them, and verifying the output.
> The general API I have in mind is would look like this:
> {code}
>      QueryTestUtil.on(jdbcUrl)
>           .createTable("testtable",
>               "id integer not null primary key",
>               "name varchar")
>           .withRows(
>               1, "name1",
>               2, "name2",
>               3, "othername")
>           .verifyQueryResults(
>               "select id, name from testtable where name like 'name%'",
>               1, "name1",
>               2, "name2");
> {code}
> The intention is to make it much less painful to write tests, and also to 
> replace as enough existing test code to use this pattern so that new tests 
> being created based on existing code will also follow this pattern.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to