You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Ramin Moazeni <rm...@gmail.com> on 2007/06/04 19:29:12 UTC
Re: [jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
Hi
I need to confirm that for converting the System.out's from the old
tests into assertions for example System.out.println("parameters count
for callable statement is: " + paramMetaData.getParameterCount());
I have to look up the expected value in the
functionTests/master/parameterMetaDataJdbc30.out when I translate
this to assertEquals?
Thanks
Ramin
On 5/30/07, Kathey Marsden (JIRA) <ji...@apache.org> wrote:
>
> [ https://issues.apache.org/jira/browse/DERBY-2658?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500234 ]
>
> Kathey Marsden commented on DERBY-2658:
> ---------------------------------------
>
> Thanks Ramin for looking at this test conversion. The main thing I think is that we really need to make sure that we are testing everything the old test tested. Below are some specific comments, but it would be good to do a close review comparing the old and new test to make sure that we have assertions for all of the cases that were tested by canon comparison before. Anyway, here are some comments ....
>
> Typically the test class name for the junit tests starts with a capital letter. e.g. ParameterMetaDataJdbc30Test
>
> parameterMetaDataJdbc30_app.properties and master/parameterMetaDataJdbc30.out should be deleted.
>
> Attach the output of svn stat to your next patch.
>
>
> When I run the test all the tests fail with
> parameterMetaDataJdbc30Test)java.sql.SQLException: Schema 'SAMPLE' does not exist
> This is I think because setUp attempts to drop the table that is not there.
> I think you would be better off using CleanDatabaseSetup and the decorateSQL method to create your table and function, rather than creating it with each fixture. There are lots of examples of CleanDatabaseSetup usage in other tests.
>
> The dumpExpectedSQLExceptions method only checks an SQLException's sqlstate against itself, so would always pass. Instead of calls to dumpExpectedSQLExceptions
> you should have assertSQLState("XXXXX",e) where XXXX is the hardcoded expected SQLState. You can see the expected states by looking at the canon in functionTests/master/parameterMetaDataJdbc30.out or just temporarily printing SQLState to see what it is.
>
>
> Calls like assertTrue ("Jira 44 failed.", "22019".equals(e.getSQLState()) can be replaced by assertSQLState
>
> The System.out's in the old test need to be translated into assertions. e.g.
> //System.out.println("parameters count for callable statement is: " + paramMetaData.getParameterCount());
> should be replaced with an assertEquals call.
>
> dumpParameterMetaDataNegative doesn't look quite right to me. It seems like it would always fail. Instead of
>
> try {
> fail("parameter isNullable " + paramMetaData.isNullable(-1));
> } catch (SQLException e) {
> dumpExpectedSQLExceptions(e);
> }
>
> I would expect something like.
> try {
> parameterMetaData.isNullable(-1);
> fail("parameterMetaData.isNullable(-1) should have failed);
> } catch (SQLException se)
> {
> assertSQLState("XCL13",se.getSQLState());
> }
>
> For the code where we have if(!usingDerbyNetClient()) there should be an explanation of why we don't run with client with a Jira reference. If there is a bug and it is not filed, file one.
>
> The fixtures testParameterMetadataWithXXXParameters () doesn't actually seem to test the parameterMetaData. I don't know if that is an artifact of the old test but we should add in some testing.
>
>
>
>
> > Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit
> > -----------------------------------------------------
> >
> > Key: DERBY-2658
> > URL: https://issues.apache.org/jira/browse/DERBY-2658
> > Project: Derby
> > Issue Type: Test
> > Components: Test
> > Affects Versions: 10.3.0.0
> > Reporter: Ramin Moazeni
> > Assignee: Ramin Moazeni
> > Fix For: 10.3.0.0
> >
> > Attachments: DERBY-2658.diff
> >
> >
> > Convert jdbcapi/parameterMetaDataJdbc30.java to JUnit.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>
Re: [jira] Commented: (DERBY-2658) Convert jdbcapi/parameterMetaDataJdbc30.java
to JUnit
Posted by Kathey Marsden <km...@sbcglobal.net>.
Ramin Moazeni wrote:
> Hi
>
>
> I need to confirm that for converting the System.out's from the old
> tests into assertions for example System.out.println("parameters count
> for callable statement is: " + paramMetaData.getParameterCount());
> I have to look up the expected value in the
> functionTests/master/parameterMetaDataJdbc30.out when I translate
> this to assertEquals?
You can do it one of two ways. You can find out the expected value a
couple different ways that I can think of.
1) Look at the test and see how many parameters there are. For example
you have 4 parameters like in cs = con.prepareCall("CALL
dummyint(?,?,?,?)"), the expected value is 4.
2) Look at the canon (.out file) and see what the value was.
Regardless you will end up with an assertion like:
assertEquals("Unexpected parameter count", x,
paramMetaData.getParameterCount())
where x is the expected value.
I hope that answers your question.
Kathey