Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 56006 invoked from network); 21 May 2008 07:22:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2008 07:22:19 -0000 Received: (qmail 64386 invoked by uid 500); 21 May 2008 07:22:16 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 64356 invoked by uid 500); 21 May 2008 07:22:16 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 64341 invoked by uid 99); 21 May 2008 07:22:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 May 2008 00:22:16 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [82.223.190.47] (HELO llsc494-a04.servidoresdns.net) (82.223.190.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 May 2008 07:21:21 +0000 Received: from [192.168.11.83] (198.Red-213-96-253.staticIP.rima-tde.net [213.96.253.198]) by smtp-04.servidoresdns.net (Postfix) with ESMTP id 75F6AED80FD for ; Wed, 21 May 2008 09:21:37 +0200 (CEST) Message-ID: <4833CD71.7090909@unkasoft.com> Date: Wed, 21 May 2008 09:21:21 +0200 From: Carlos Alonso User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Ant Users List Subject: Re: Defining ant target to run junit tests using dbunit References: <17342896.post@talk.nabble.com> <4832FA7F.30307@unkasoft.com> <17348563.post@talk.nabble.com> In-Reply-To: <17348563.post@talk.nabble.com> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Have you included the java junit.jar library into the classpath provided for the junit task? The TestListener class is actually included in that .jar file. Regards. Carlos tmni escribió: > I appreciate both attempts to help. > I had already viewed that other web page and tried to follow it. It doesn't > provide quite enough > detail for me. > > I did try using some of the sample code provided. I was able to eliminate > the error about not > finding the oracle driver. But now when I try to include a junit taskdef, I > get a classpath error that > a class needed by JUnitTask (TestListener) is not found. As far as I can > tell, it is on the classpath, so no > idea what this all about. I tried a couple ways of including it in the > classpath within the build.xml file. > > Sure would be nice if someone had a sample who had also written junit tests > using dbunit for a web app > using Hibernate and Oracle. I simply cannot get this to work;very > frustrating... > > > Carlos Alonso-2 wrote: > >> Hi tmni, >> >> About the authentication exception that you're getting, I cannot guess >> neither cause nor solution, but I think the following source code could >> be helpful. >> >> The first point is the problem you're getting with the oracle driver >> load. I think that the point is that you have not defined where Ant can >> find the class that implements the driver. I've never used Oracle, but I >> don't think it differs much on mysql. In the following source code you >> can check that the .jar file where the driver is implemented is directly >> pointed out by the classpath argument, so try adding the .jar file to >> the classpath. >> >> > driver = "com.mysql.jdbc.Driver" >> password = "pass" >> url = "jdbc:mysql://127.0.0.1/" >> userid = "pass" >> autocommit = "true" >> classpath = "${lib}/mysql-connector-java-5.0.4-bin.jar" >> > >> . >> . >> . >> >> >> Regarding now to the second problem to set the tests you want to be >> executed, have a look at the code below, instead of dbunit I use Junit >> as you can see, but I don't think they are very different. >> >> As for the previous situation, you'll have to define a classpath from >> which your tests will be compiled, and then, include them in a >> resource into the task. >> The formatter elements that you can see over specify the output that the >> junit task will produce. >> >> > >> classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" >> classpath="${scripts}/tools/ant-junit.jar" >> /> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> I hope it may help you. >> Regards. >> Carlos >> >> tmni escribió: >> >>> I am relatively new to ant and am having trouble setting up a target to >>> run a >>> series of junit tests. >>> These tests all run fine when I launch them via eclipse. But if I try to >>> run ant directly via command prompt, I get errors. First, I was getting >>> error like: >>> Error 'Unexpected failure during bean definition parsing in resource URL >>> [file:spring-misc-junit.xml] at: >>> Bean 'mailSender'; nested exception is java.lang.SecurityException: class >>> “javax.mail.AuthenticationFailedException”’s signer information does not >>> match signer information of other classes in the same package. >>> >>> I thought it might have something to do with authenticating to database, >>> so >>> tried adding the following >>> dbunit info. I got an error that there must be at least 1 step in a >>> dbunit >>> task. I tried adding a task to do >>> an insert, but don't know why this would be necessary since the test >>> themselves set up the test data, accessing a test data xml file. Even >>> with >>> that change, I get error that oracle driver cannot be loaded. >>> >>> The tests use dbunit and the underlying database is Oracle (accessed via >>> Hibernate in application). >>> I can't figure out how to define the test target and I cannot find a >>> sample >>> that does this. Does >>> anyone have a sample ant build file that runs junit tests that use >>> dbunit/hibernate/oracle combination?? >>> >>> >>> >> classname="org.dbunit.ant.DbUnitTask" /> >>> >> url="jdbc:oracle:thin:@server:port:dbname" >>> userid="me" >>> password="password"> >>> >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org >> For additional commands, e-mail: user-help@ant.apache.org >> >> >> >> > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org