X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C0ABCEAE4AA for ; Fri, 22 Oct 2004 21:21:34 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 52459-05 for ; Fri, 22 Oct 2004 20:21:40 +0000 (GMT) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by svr1.postgresql.org (Postfix) with ESMTP id 9A588EAE492 for ; Fri, 22 Oct 2004 21:21:30 +0100 (BST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id i9MKLngg006559 for ; Fri, 22 Oct 2004 16:21:49 -0400 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id i9MKLnr22980 for ; Fri, 22 Oct 2004 16:21:49 -0400 Received: from 192.168.1.2 (vpn83-129.boston.redhat.com [172.16.83.129]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id i9MKLlPd028732 for ; Fri, 22 Oct 2004 16:21:47 -0400 From: Vadim Nasardinov Organization: Red Hat / Westford To: pgsql-jdbc@postgresql.org Subject: patch: bring org/postgresql/test/README up to date Date: Fri, 22 Oct 2004 16:27:20 -0400 User-Agent: KMail/1.5.4 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_o0WeBwMBlql6mM4" Message-Id: <200410221627.20176@vadim.nasardinov> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/235 X-Sequence-Number: 11340 --Boundary-00=_o0WeBwMBlql6mM4 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Is this the right list for sending JDBC-specific patches or should they be directed to pgsql-patches@postgresql.org? Anyhow- Changes This patch partially brings org/postgresql/test/README up to date. The document doesn't seem to haved changed much since 2001: http://archives.postgresql.org/pgsql-jdbc/2001-08/msg00350.php http://archives.postgresql.org/pgsql-patches/2001-09/msg00000.php http://archives.postgresql.org/pgsql-jdbc/2001-09/msg00155.php Since the JDBC driver is no longer part of the main tree in http://developer.postgresql.org/cvsweb.cgi/pgsql/ I removed all references to the latter. I also updated the document to reflect the fact that the tests are now run via "ant test" rather than "make; make check". I also updated a couple of paths to files that seem to have been shuffled around. Lastly, I deleted trailing whitespace. Question The document refers to http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html Would it make sense to provide instructions for the seemingly newer test suite available at http://java.sun.com/products/jdbc/jdbctestsuite-1_3_1.html Thanks, Vadim --Boundary-00=_o0WeBwMBlql6mM4 Content-Type: text/x-diff; charset="us-ascii"; name="test-README.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test-README.diff" Index: org/postgresql/test/README =================================================================== RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/README,v retrieving revision 1.3 diff -c -r1.3 README *** org/postgresql/test/README 11 Aug 2003 21:20:50 -0000 1.3 --- org/postgresql/test/README 22 Oct 2004 20:08:15 -0000 *************** *** 18,29 **** configure and run this test suite. Furthermore, it offers guidelines and an example for developers to add new test cases. ! Sun provides two standard JDBC test suites that you may also find useful. http://java.sun.com/products/jdbc/download2.html (JDBC 1) http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html (JDBC 2, including J2EE requirements) ! The JDBC 2 test suite is covered in section 8 below. The JDBC 1 test suite is not currently covered in this document. 2 Installation --- 18,29 ---- configure and run this test suite. Furthermore, it offers guidelines and an example for developers to add new test cases. ! Sun provides two standard JDBC test suites that you may also find useful. http://java.sun.com/products/jdbc/download2.html (JDBC 1) http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html (JDBC 2, including J2EE requirements) ! The JDBC 2 test suite is covered in section 8 below. The JDBC 1 test suite is not currently covered in this document. 2 Installation *************** *** 41,89 **** dynamically detect that JUnit is present and then build the JDBC test suite. ! You need to install and build the PostgreSQL source tree. You ! can download it from http://www.postgresql.org/devel-corner/. ! See README and INSTALL in the top of the tree for more ! information. ! ! You should run ./configure with the command line option ! --with-java. You may also want to use --with-pgport to compile a ! non-standard default port number (e.g. 5433) into all ! components. This will cause the server to listen on this ! non-standard port and it will cause the JDBC driver to connect ! to this port by default. In this way your testing environment is ! easily separated from other PostgreSQL applications on the same ! system. ! ! In this Howto we'll use $JDBC_SRC to refer to the directory ! src/interfaces/jdbc of the PostgreSQL source tree in your ! environment. The test suite is located in the subdirectory ! $JDBC_SRC/org/postgresql/test. 3 Configuration --------------- ! The test suite requires a PostgreSQL database to run the tests ! against and a user to login as. For a full regression test of ! the entire PostgreSQL system, you should run the test against a ! server built from the same source tree as the driver you're ! testing. The tests will create and drop many objects in this ! database, so it should not contain production tables to avoid loss of data. We recommend you assign the following names: database: test username: test password: password ! These names correspond with the default names set for the test ! suite in $JDBC_SRC/build.xml. If you have chosen other names you ! need to edit this file and change the properties "database", ! "username" and "password" accordingly. 4 Running the test suite ------------------------ %cd $JDBC_SRC ! %make ! %make check This will run the command line version of JUnit. If you'd like to see an animated coloured progress bar as the tests are --- 41,75 ---- dynamically detect that JUnit is present and then build the JDBC test suite. ! You need to install and build the PostgreSQL JDBC driver source ! tree. You can download it from http://jdbc.postgresql.org/. See ! README in the top of the tree for more information. ! ! In this Howto we'll use $JDBC_SRC to refer to the top-level directory ! of the JDBC driver source tree. The test suite is located in the ! subdirectory $JDBC_SRC/org/postgresql/test. 3 Configuration --------------- ! The test suite requires a PostgreSQL database to run the tests against ! and a user to login as. The tests will create and drop many objects in ! this database, so it should not contain production tables to avoid loss of data. We recommend you assign the following names: database: test username: test password: password ! These names correspond with the default names set for the test suite ! in $JDBC_SRC/build.xml. If you have chosen other names you need to ! create a file named $JDBC_SRC/build.local.properties and add your ! customized values of the properties "database", "username" and ! "password". 4 Running the test suite ------------------------ %cd $JDBC_SRC ! %ant test This will run the command line version of JUnit. If you'd like to see an animated coloured progress bar as the tests are *************** *** 96,102 **** 5 Extending the test suite with new tests ----------------------------------------- ! If you're not familiar with JUnit, we recommend that you first read the introductory article "JUnit Test Infected: Programmers Love Writing Tests" on http://junit.sourceforge.net/doc/testinfected/testing.htm. --- 82,88 ---- 5 Extending the test suite with new tests ----------------------------------------- ! If you're not familiar with JUnit, we recommend that you first read the introductory article "JUnit Test Infected: Programmers Love Writing Tests" on http://junit.sourceforge.net/doc/testinfected/testing.htm. *************** *** 104,110 **** following concepts: test suite, test case, test, fixture, assertion, failure. ! The test suite consists of test cases, which consist of tests. A test case is a collection of tests that test a particular feature. The test suite is a collection of test cases that together test the driver - and to an extent the PostgreSQL --- 90,96 ---- following concepts: test suite, test case, test, fixture, assertion, failure. ! The test suite consists of test cases, which consist of tests. A test case is a collection of tests that test a particular feature. The test suite is a collection of test cases that together test the driver - and to an extent the PostgreSQL *************** *** 121,129 **** 1) Add a class that extends junit.framework.TestCase. It should contain setUp() and tearDown() methods that create and destroy the fixture respectively. ! 2) Edit $JDBC_SRC/org/postgresql/test/JDBC2Tests.java and add a ! suite.addTestSuite() call for your class. This will make the ! test case part of the test suite. 6 Guidelines for developing new tests ------------------------------------- --- 107,116 ---- 1) Add a class that extends junit.framework.TestCase. It should contain setUp() and tearDown() methods that create and destroy the fixture respectively. ! 2) Edit $JDBC_SRC/org/postgresql/test/jdbc2/Jdbc2TestSuite.java or ! $JDBC_SRC/org/postgresql/test/jdbc3/Jdbc3TestSuite.java and add a ! suite.addTestSuite() call for your class. This will make the test case ! part of the test suite. 6 Guidelines for developing new tests ------------------------------------- *************** *** 146,153 **** The JUnit FAQ explains how to test for a thrown exception. ! Avoid the use of the deprecated TestCase.assert(), since it will ! collide with the new assert keyword in the Java 2 platform version 1.4. As a rule, the test suite should succeed. Any errors or failures --- 133,140 ---- The JUnit FAQ explains how to test for a thrown exception. ! Avoid the use of the deprecated TestCase.assert(), since it ! collides with the new assert keyword in the Java 2 platform version 1.4. As a rule, the test suite should succeed. Any errors or failures *************** *** 156,167 **** just to make it clear that something needs to be fixed somewhere. That's what the TODO lists are for. ! Add some comments to your tests to explain to others what it is you're testing. A long sequence of JDBC method calls and JUnit assertions can be hard to comprehend. ! For example, in the comments you can explain where a certain test ! condition originates from. Is it a JDBC requirement, PostgreSQL behaviour or the intended implementation of a feature? 7 Example (incomplete) --- 143,154 ---- just to make it clear that something needs to be fixed somewhere. That's what the TODO lists are for. ! Add some comments to your tests to explain to others what it is you're testing. A long sequence of JDBC method calls and JUnit assertions can be hard to comprehend. ! For example, in the comments you can explain where a certain test ! condition originates from. Is it a JDBC requirement, PostgreSQL behaviour or the intended implementation of a feature? 7 Example (incomplete) *************** *** 201,212 **** stmt.executeUpdate( "CREATE TABLE testfoo(pk INTEGER, col1 INTEGER)"); stmt.executeUpdate("INSERT INTO testfoo VALUES(1, 0)"); ! ! // You may want to call con.setAutoCommit(false) at // this point, if most tests in this test case require // the use of transactions. } ! protected void tearDown() throws Exception { con.setAutoCommit(true); if (stmt != null) { --- 188,199 ---- stmt.executeUpdate( "CREATE TABLE testfoo(pk INTEGER, col1 INTEGER)"); stmt.executeUpdate("INSERT INTO testfoo VALUES(1, 0)"); ! ! // You may want to call con.setAutoCommit(false) at // this point, if most tests in this test case require // the use of transactions. } ! protected void tearDown() throws Exception { con.setAutoCommit(true); if (stmt != null) { *************** *** 217,234 **** TestUtil.closeDB(con); } } ! public void testFoo() { // Use the assert methods in junit.framework.TestCase // for the actual tests ! // Just some silly examples assertNotNull(con); if (stmt == null) { fail("Where is my statement?"); } } ! public void testBar() { // Another test. } --- 204,221 ---- TestUtil.closeDB(con); } } ! public void testFoo() { // Use the assert methods in junit.framework.TestCase // for the actual tests ! // Just some silly examples assertNotNull(con); if (stmt == null) { fail("Where is my statement?"); } } ! public void testBar() { // Another test. } *************** *** 236,242 **** 8. Running the JDBC 2 test suite from Sun against PostgreSQL ------------------------------------------------------------ ! Download the test suite from http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html This is the JDBC 2 test suite that includes J2EE requirements. --- 223,229 ---- 8. Running the JDBC 2 test suite from Sun against PostgreSQL ------------------------------------------------------------ ! Download the test suite from http://java.sun.com/products/jdbc/jdbctestsuite-1_2_1.html This is the JDBC 2 test suite that includes J2EE requirements. *************** *** 303,323 **** $ cd $CTS_HOME/tests/jdbc/ee $ make jdbc-tests ! ! At the time of writing of this document, a great number of tests in this test suite fail. 9 Credits, feedback ------------------- ! The parts of this document describing the PostgreSQL test suite ! were originally written by Rene Pijlman. Liam Stewart contributed the section on the Sun JDBC 2 test suite. Please send your questions about the JDBC test suites or suggestions for improvement to the pgsql-jdbc@postgresql.org mailing list. ! The source of this document is maintained in ! src/interfaces/jdbc/org/postgresql/test/README in CVS. Patches for ! improvement can be send to the mailing list pgsql-patches@postgresql.org. --- 290,310 ---- $ cd $CTS_HOME/tests/jdbc/ee $ make jdbc-tests ! ! At the time of writing of this document, a great number of tests in this test suite fail. 9 Credits, feedback ------------------- ! The parts of this document describing the PostgreSQL test suite ! were originally written by Rene Pijlman. Liam Stewart contributed the section on the Sun JDBC 2 test suite. Please send your questions about the JDBC test suites or suggestions for improvement to the pgsql-jdbc@postgresql.org mailing list. ! The source of this document is maintained in ! org/postgresql/test/README in CVS. Patches for ! improvement can be send to the mailing list pgsql-patches@postgresql.org. --Boundary-00=_o0WeBwMBlql6mM4--