File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Create XML from Junit Testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Create XML from Junit Testing" Watch "Create XML from Junit Testing" New topic
Author

Create XML from Junit Testing

Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
What is wrong with my build.xml file?



When i'm running this, I get this as result:



Somebody knows whats going wrong? Sorry for the big error trace, but I hope someone can find the error faster..
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1665
    
    7

Hmm, strange. What happens when you disable JVM forking for the JUnit task?


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
Jelle Klap wrote:Hmm, strange. What happens when you disable JVM forking for the JUnit task?


Same error..
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19538
    
  16

Gynnad Paullussen wrote:

That's the main issue - the file can't be written to. Since this exception is thrown when creating a FileOutputStream, the issue is not caused by the XML file not existing. That leaves the following options:
1) Folder C:\CMSdot2\plugins\CustomLogin\testreport does not exist yet. However, it should have been created by the makedir target which is triggered by the compile script.
2) You (read: the user running ANT) don't have enough rights to write to this folder. The exception message isn't always telling the truth.
3) You (read: the user running ANT) don't have enough rights to write to this file.
4) The file is still in use by some process.
5) ?? (I can't think of any more reasons).


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
The strange thing is, the file exists, this is the output:



Sorry it is a big and long file!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19538
    
  16

Perhaps this file has been created by a previous test run, and now you don't have access to modify it anymore. One reason could be some process still having an open handle to the file.
Gynnad Paullussen
Ranch Hand

Joined: Jan 26, 2011
Posts: 49
That is not the problem, Now I changed it to this:



But I get this error:


But when I'm going to the C:/Program Files (x86)/Apache Ant/lib/junit.jar path it is correct. Or what do I need to fill in in this: <classpath refid="test.classpath" />
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19538
    
  16

In your original ANT file you used Later on you had a refid to this "junit.class.path". So all you need to do to get that classpath tag to work is to add a path element with the same ID.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create XML from Junit Testing
 
Similar Threads
Spring : DefaultAnnotationHandlerMapping not mapping URL using annotation
Ant error on trying to run an taskdef
javadoc problem, using ant build file
Howto run specific JUnit tests in ant?
Problem when including unit test cases in build