[
https://issues.apache.org/jira/browse/DERBY-3050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560852#action_12560852
]
Daniel John Debrunner commented on DERBY-3050:
----------------------------------------------
> 'm still a beginner at this process of converting the old-style IJ script
> tests to JUnit ...
Just a reminder that setup and tearDown is executed once per fixture (each
testXXX method) not once per class.
>From a quick look at the test fixtures it seems they do not modify the data,
>thus would it make more sense to perform
the setup using the facilities of CleanDatabaseTestSetup? Ie.
CleanDatabaseTestSetup.decorateSQL. Then no test specific
code is needed for cleanup.
Usuallly test classes do not need instance variables for JDBC objects (e.g
Statements and ResultSets). They provide almost no benefit and have the
downside that either code is needed to clean them up (assign the fields to
null) or they continue to use memory after the test has finished.
Such fields provide no benefit because the object in the field (e.g. a
Statement) is not shared across fixtures, each fixture is represented by a
unique instance of the class, thus with N fixutures N Statements will be
created rather than the one that might be assumed by using a field. Since the
Statement is local to the fixture it becomes cleaner to keep it locally scoped
in the testXXX() fixture method, passing it into utility methods as required.
The only benefit can be sharing a Statement object across a testXXX fixuture
method and setup/teardown methods. Since Statement objects are not expensive to
create then I think this is of dubious value, I think it's clearer for someone
reading the test later to understand the code with a locally scoped object
rather than an instance object.
> Convert groupBy.sql tests to JUnit and include them in GroupByTest.java
> -----------------------------------------------------------------------
>
> Key: DERBY-3050
> URL: https://issues.apache.org/jira/browse/DERBY-3050
> Project: Derby
> Issue Type: Sub-task
> Components: Test
> Affects Versions: 10.4.0.0
> Reporter: Bryan Pendleton
> Assignee: Bryan Pendleton
> Priority: Minor
> Attachments: convertToJunit.diff, convertToJUnit.diff,
> convertToJUnit.stat
>
>
> There are currently 3 sets of GROUP BY tests:
> - GroupByExpressionTest.java
> - GroupByTest.java
> - groupBy.sql
> The first two tests are JUnit tests; the groupBy.sql tests are old-style
> harness tests,
> although they are now run in the JUnit framework using the LangScripts
> technique.
> This sub-task proposes to convert the groupBy.sql tests to JUnit tests, and
> to include
> them directly into GroupByTest.java.
> The DERBY-2151 conversion tool can be used to assist in the conversion
> process.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.