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

Julian Hyde commented on CALCITE-2457:
--------------------------------------

This discussion is missing one important consideration: how much effort is 
required to update reference data.

It was this consideration that led to externalized resources, e.g. 
SqlToRelConverterTest.xml, RelOptRulesTest.xml. Such resources can be updated 
by copying a file from target to src.

Most tests use what I call 'assertion-based testing', but I believe that some 
tests require an approach I will call 'comparison-based testing'. Tests should 
use assertion-based testing if possible, but some tests require 
comparison-based testing.

Why is comparison-based testing necessary? It is not practical to write a test 
that checks that a 100-line plan contains lines X, Y and Z. That test will need 
to be updated from time to time, and to safely perform that update, you need to 
see what were the other 97 lines at the time the test was written (or last 
updated). Assertion-based testing requires copy-pasting test output into test 
source code, and that is too onerous for some tests.

So, our test infrastructure needs to also support comparison-based testing.

Incidentally, Quidem is a serious attempt to combine the benefits of 
comparison- and assertion-based testing. The source code of the test contains 
the output, and the output is valid source code. Quidem's language (its set of 
commands) allow assertions on the output: for example you can require that a 
statement returns 10 rows, capture those 10 rows in the output (source file), 
but only fail if the count is not 10.

> Upgrade to JUnit 5
> ------------------
>
>                 Key: CALCITE-2457
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2457
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>         Attachments: assert_equals.png, truth_assertmap.png
>
>
> JUnit 5 brings multiple useful features so tests are easier to read and write.
> Is there something that blocks upgrading to JUnit 5?
> By upgrade I mean bumping up the dependency version and creating new tests 
> with JUnit 5 features.
> Relevant features of JUnit 5: dynamic test, nested tests, parameterized tests
> https://twitter.com/nipafx/status/1027095088059559936



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to