aspose file tools*
The moose likes Testing and the fly likes Why XML for units tests? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Why XML for units tests?" Watch "Why XML for units tests?" New topic
Author

Why XML for units tests?

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hi.
Writing tests should be easy and fast.
Why did you decide to use XML files to configure test suites?
Thanks.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
At first you talked about writing tests and then latter you are asking why about configuring. So, its clear and you know that we write test in Java using JUnit or other extensions and then configure the test suite using XML.

Now there are several benefits of configuring a test suite.

- You can use your test suite in continuous integration
- You can use your test suite to analyse code coverage
- Typically test suites are flexible enough to run a single test.
- Sometimes you need different database configuration say, test, prod, dev. It helps configuring these.

Its not at all difficult to configure a test suite. There are lots of tools available for that.
[ December 18, 2007: Message edited by: Adeel Ansari ]
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Yes, I understand this but writing XML file for test seems overkill to me.
Why not to write a Java class instead of XML?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30762
    
156

Originally posted by John Todd:
Yes, I understand this but writing XML file for test seems overkill to me.

Me too!


Yes, I understand this but writing XML file for test seems overkill to me.

One reason listed frequently is that it avoids a recompile. I don't fully understand the benefits of avoiding the recompile though, hence my question:
Why is recompiling bad?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Hani Suleiman
author
Greenhorn

Joined: Nov 18, 2007
Posts: 22
One thing worth clarifying, you do NOT need an xml configuration file to run a test, it's just one of the (many) options.

Other options include:
- ant
- IDEA
- Eclipse
- command line

None of the above require an xml file, you can just select a test class and run it directly.

I'll cover the benefits of using an xml configuration file in another thread.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Why XML for units tests?