ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlcarpen...@household.com
Subject Re: Changing Working Directory to get tests to work (The Solution)
Date Tue, 06 Aug 2002 17:28:11 GMT

After leaving for home yesterday, I realized the solution was staring me in
the face all along.  To get a junit test runner to execute with a working
directory corresponding to the Ant project in VAJ rather than the JUnit
project, I have only to create a test class with a main method in the Ant
project.  The main method simply executes the test runner of choice.

It is important to list all the necessary projects in the classpath
property for this class (I have JUnit, Xerces Apache, Ant, JAXP, W3CXML).

As a side note, the AbstractCvsTaskTest makes use of anonymous access to
the jakarta cvs server.  Since I am behind a tight corporate firewall this
fails.  It might be better to instead create a local cvs repository with
the cvs init command.  My gut feeling is this is too much work, and poor
saps like myself will survive as it is.

The class I created in the Ant project is:
==================================================
package org.apache.tools.ant;

import junit.awtui.TestRunner;
//import junit.textui.TestRunner;
/**
 * Insert the type's description here.
 * Creation date: (08/06/2002 9:31:09 AM)
 * @author: James L. Carpenter
 */
public class AWTTestRunner {
/**
 * AWTTestRunner constructor comment.
 */
public AWTTestRunner() {
     super();
}
/**
 * Insert the method's description here.
 * Creation date: (08/06/2002 9:34:14 AM)
 * @param args java.lang.String[]
 */
public static void main(String[] args) {

     TestRunner runner = new TestRunner();
     runner.start(new String[]
{"org.apache.tools.ant.taskdefs.AbstractCvsTaskTest"});

}
}
====================================================


James Lee Carpenter
Software Engineer
Household Technical Services
6602 Convoy Court
San Diego, CA 92111

ph: 858-609-2461
email: jlcarpenter@household.com


                                                                                         
                          
                                                                                         
                          
                        jlcarpenter@house      To:    "Ant Developers List" <ant-dev@jakarta.apache.org>
           
                        hold.com               cc:                                       
                          
                                               Subject:    Changing Working Directory to get
tests to work          
                        08/05/2002 06:20                                                 
                          
                        PM                                                               
                          
                        Please respond to                                                
                          
                        "Ant Developers                                                  
                          
                        List"                                                            
                          
                                                                                         
                          
                                                                                         
                          




I am having problems running the Ant tests within Visual Age for Java.
This has to do with relative file paths to xml build files being
incorrectly resolved.  VAJ starts the test runner with a working directory
corresponding to the Junit project rather than the Ant project.  I can't
seem to change this, so I would like to know how to have java change its
working directory during runtime.  I can then write a wrapper to the junit
runner that fixes the problem.

Does anyone know how a java program can change its working directory?

James Lee Carpenter
Software Engineer
Household Technical Services
6602 Convoy Court
San Diego, CA 92111

ph: 858-609-2461
email: jlcarpenter@household.com


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>






--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message