This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Testing and the fly likes Automated Regression Testing suite Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Automated Regression Testing suite" Watch "Automated Regression Testing suite" New topic
Author

Automated Regression Testing suite

Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Hi guys,
My final year project is to automate the testing process which is done for an application. I did a research and found that combination of JUnit, Clover and ANT shall be used to make the automated testing process going. I use Eclipse as my IDE. Clover is a proprietary software and I want you to suggest a code coverage analysis tool that is an an open source which can be used with both JUnit and Ant on Eclipse IDE. The technology should also be simple to use even by a novice (I am a novice to all these technologies).

PS: The application is built on Struts framework

Thanks in advance


The greater danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30075
    
149

Sujai,
I like emma for code coverage. It is open source and free.


[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
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Thanks Jeanne for your reply

I went through some of the FAQ's about Emma. It is stated that

"Independently of any user-provided instrumentation filters, EMMA always excludes the following from coverage:

1. Methods that have no executable Java bytecode: abstract methods, native methods;
2. Java interface classes (even though they may have executable static initializers).


Additionally, the following types of methods are excluded by default, but can be included by setting the appropriate instrumentation property:

1. Methods marked as Synthetic by the compiler: these are usually "helper" methods needed by the compiler to implement certain Java Language constructs like inner class access, etc. These methods have no user-provided code.
2. Bridge methods created by Java 1.5 compilers to graft new language features on the existing class format."


Is that a disadvantage in using Emma?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30075
    
149

Sujai,
The default behavior gives you less "noise" in the reports. If you really want it, you can turn it on though. So I wouldn't see it as a disadvantage since it is under your control.
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Okay Jeanne. Thank you for clarifying
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
emmatask

This is a wonderful article to start with. I did created the directory structure and placed files like in the example


I put two simple java files and its respective JUnit test cases along with the same files

I created a build.xml file with just copy pasting the targets from the above link. I copied just the following:




I didn't added anything to the build file. When I run the build file I get the following message:



I placed my project in C:\ . What is the thing that went wrong. Since, I am starting with these only now, I cannot figure it out. Where should I place the test codes of JUnit, I mean how the emma task will identify JUnit test code from the actual code (I placed both together in the src directory)?

I expect a cookbook like assistance . Its really embarrassing to ask again and again the same thing.

Kindly help me on this problem.

PS: I am not using any IDEs now
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30075
    
149

The first step in debugging is to determine exactly what is failing. I suspect it is the part where you import the taskdef. One way to find out is to remove everything after that and see if it still fails. Also, try outputting the path right before the failure to see if it looks right on your machine. or try hard coding the absolute path of the jar.
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Hi Jeane,
I was able to correct that mistake and my build was successful. But as stated in that example, folders were created, but the instrumented class files and the METADATA file are not generated. I post the build script here:



I get the following output:

what kind of alteration should I do in order to generate those files?
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
I also post the actual code. To begin with, I just coded a small sample program which computes sum, difference and product:



I also wrote a JUnit testcode for this file which also lies in the same directory
Sujai Kaarthik
Ranch Hand

Joined: Dec 29, 2008
Posts: 162
Hi Jeane,
I have finally made it. I am very happy that I was able to successfully integrate JUnit and Emma with Ant. Your little guidance was very helpful along the path.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Automated Regression Testing suite
 
Similar Threads
migrating to linux
Your favorite tool for code coverage
Clean Code: Agile toolkit
Which IDE is used in the book?
Maven: What's the big deal?