• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Automated Regression Testing suite

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sujai,
I like emma for code coverage. It is open source and free.
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay Jeanne. Thank you for clarifying
 
Sujai Kaarthik
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic