Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 63729 invoked from network); 21 Aug 2006 19:31:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Aug 2006 19:31:38 -0000 Received: (qmail 54898 invoked by uid 500); 21 Aug 2006 19:31:38 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 54875 invoked by uid 500); 21 Aug 2006 19:31:37 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 54864 invoked by uid 99); 21 Aug 2006 19:31:37 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Aug 2006 12:31:37 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Aug 2006 12:31:36 -0700 Received: from ajax.apache.org (localhost [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id D6962D4973 for ; Mon, 21 Aug 2006 20:31:15 +0100 (BST) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Apache Wiki To: derby-commits@db.apache.org Date: Mon, 21 Aug 2006 19:31:15 -0000 Message-ID: <20060821193115.18022.50684@ajax.apache.org> Subject: [Db-derby Wiki] Update of "DerbyJUnitTesting" by DanDebrunner X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Dear Wiki user, You have subscribed to a wiki page or wiki category on "Db-derby Wiki" for change notification. The following page has been changed by DanDebrunner: http://wiki.apache.org/db-derby/DerbyJUnitTesting ------------------------------------------------------------------------------ [[TableOfContents]] == The junit test type == - The name of a Derby test is the argument supplied to `org.apache.derbyTesting.functionTests.harness.RunTest` when the test is run. Derby JUnit test names always end with `.junit`, e.g. `somesuite/SomeTest.junit`. In other words, the test type is `junit`. The file that implements a test is a java file, e.g. `SomeTest.java`. The test harness uses the last part of the ''name'' to decide how it should run the test. If the name ends with `.java`, the harness knows that the test is a java class with a `main()` method. If the name ends with `.junit`, the harness knows it is a java class which can be run by a JUnit test runner. + The name of a Derby test is the argument supplied to `org.apache.derbyTesting.functionTests.harness.RunTest` when the test is run. Derby JUnit test names always end with `.junit`, e.g. `somesuite/SomeTest.junit`. In other words, the test type is `junit`. The file that implements a test is a java file, e.g. `SomeTest.java`. The test harness uses the last part of the ''name'' to decide how it should run the test. If the name ends with `.java`, the harness knows that the test is a java class with a `main()` method. If the name ends with `.junit`, the harness knows it is a java class which can be run by a JUnit test runner. No actual file exists with the `.junit` suffix. == Base JUnit test classes == After some discussion on derby-dev, a set of base classes to be used when writing JUnit tests were created. These are: - * `org.apache.derbyTesting.functionTests.util.BaseTestCase` + * `org.apache.derbyTesting.junit.BaseTestCase` - * `org.apache.derbyTesting.functionTests.util.BaseJDBCTestCase` + * `org.apache.derbyTesting.junit.BaseJDBCTestCase` - * `org.apache.derbyTesting.functionTests.util.BaseJDBCTestSetup` + * `org.apache.derbyTesting.junit.BaseJDBCTestSetup` - * `org.apache.derbyTesting.functionTests.util.TestConfiguration` + * `org.apache.derbyTesting.junit.TestConfiguration` - * `org.apache.derbyTesting.functionTests.util.JDBCClient` + * `org.apache.derbyTesting.junit.JDBCClient` * `org.apache.derbyTesting.functionTests.util.JDBC` + {i} These classes were moved to their current package from `org.apache.derbyTesting.functionTests.util` as + they can apply to more than functional tests. + - Note that the class `DerbyJUnitTest` in the same package is [http://www.mail-archive.com/derby-dev@db.apache.org/msg23272.html deprecated]. + Note that the class `org.apache.derbyTesting.functionTests.util.DerbyJUnitTest` is [http://www.mail-archive.com/derby-dev@db.apache.org/msg23272.html deprecated]. To write a JUnit test that uses JDBC, make your test class extend `BaseJDBCTestCase`. This class is subclass of [http://www.junit.org/junit/javadoc/3.8.1/junit/framework/TestCase.html TestCase] in JUnit framework and you can add test methods, write your `setUp` and `tearDown` methods and finally the `suite` method that returns a suite of tests to run (typically all tests in the test class). `BaseJDBCTestCase` provides a set of often used functionality, for instance the method `getConnection` to obtain a connection to the default database. If you are missing something, ask on derby-dev or create a sub-task/link a Jira issue to DERBY-1122. @@ -31, +34 @@ `JDBC` holds test utility methods related to JDBC objects. - Remember that the methods `setUp` and `tearDown` are run before and after each test method in your class. If you want to run some code only once before or after all test methods in your class, you can consider using a `BaseJDBCTestSetup` or `TestSetup` test decorator. + Remember that the methods `setUp` and `tearDown` are run before and after each test method (fixture) in your class. If you want to run some code only once before or after all test methods in your class, you can consider using a `BaseJDBCTestSetup` or `TestSetup` test decorator. Information about JUnit can be found at http://www.junit.org The usage of JUnit in Derby is currently based on JUnit 3.8.1.