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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "JUnit v Cactus?" Watch "JUnit v Cactus?" New topic
Author

JUnit v Cactus?

Tabitha Scott
Greenhorn

Joined: Jun 18, 2004
Posts: 5
Hi everyone. I was hoping you could help clear up some confusion on my part.

Is Cactus an extension of JUnit? Or is it a different implementation of JUnit, with additional features? I'm having trouble deciding what framework to use.

Also, since I have your attention, can I use JMeter and JUnit together? Everything I find online seems to point back to the 'main' sites... which are confusing to me to beign with.

Thanks so much for your time and help!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Tabitha Scott:
Is Cactus an extension of JUnit? Or is it a different implementation of JUnit, with additional features?

Cactus is a "JUnit extension" meaning that the Cactus API uses and extends the JUnit API.

Originally posted by Tabitha Scott:
I'm having trouble deciding what framework to use.

Test what you can with JUnit. If you're developing a web or EJB application, you might end up with pieces of code that you can't test using JUnit because you need to run the code in a J2EE application server for it to work. That's where you take Cactus into use -- you deploy the code to the server and run your Cactus tests against that server instance.

Originally posted by Tabitha Scott:
Also, since I have your attention, can I use JMeter and JUnit together?

No, you can't. JMeter has its own way of scripting performance test scripts.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Originally posted by Tabitha Scott:
Also, since I have your attention, can I use JMeter and JUnit together?

If you want to use JUnit tests to stress/load test your system than I suggest you take a look at The Grinder. Just like JMeter, The Grinder is an OSS load-testing tool. I have used it previously on a few projects and I actually prefer it to JMeter.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Another JUnit extension for (rather limited) performance testing is Mike Clark's JUnitPerf.
Tabitha Scott
Greenhorn

Joined: Jun 18, 2004
Posts: 5
First off, thank you Chris and Lasse for your responses. I appreciate your time.

After reading and re-reading your responses and my task at hand, I think I may be trying to force JUnit into a project that doesn't need it.

Right now, I have an application where the test case data is embedded in the code. I'm trying to move the test cases into a more felxible framework. I was thinking JUnit should be used. However, the more I think about it, these test cases need to provide data.

Doesn't JUnit just ensure that the code executes properly? The TestResult that one would get from running a JUnit test is either Pass or Fail, correct? So maybe I shouldn't be using JUnit at all?

Any other opinions would be greatly appreciated. I apoligize if my logic is difficult to follow. I'm still new to the world of unit testing.

Thanks again!
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
Originally posted by Tabitha Scott:
First off, thank you Chris and Lasse for your responses. I appreciate your time.

After reading and re-reading your responses and my task at hand, I think I may be trying to force JUnit into a project that doesn't need it.

Right now, I have an application where the test case data is embedded in the code. I'm trying to move the test cases into a more felxible framework. I was thinking JUnit should be used. However, the more I think about it, these test cases need to provide data.

Doesn't JUnit just ensure that the code executes properly? The TestResult that one would get from running a JUnit test is either Pass or Fail, correct? So maybe I shouldn't be using JUnit at all?

Any other opinions would be greatly appreciated. I apoligize if my logic is difficult to follow. I'm still new to the world of unit testing.

Thanks again!


May be i am wrong, but as far as i remember 'Mock Objects' concept can be used to enable multiple data to be used for your unit testing with the help of JUnit.


Kishore
SCJP, blog
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Tabitha, could you describe what you want to test? Maybe we would then be in a better position to suggest how to do that.
Tabitha Scott
Greenhorn

Joined: Jun 18, 2004
Posts: 5
Sure, I can explain more.

What I'm currently testing are a slew of possible entries in a request. I'm adding information into a request form, and then sending the form to be processed. Based on what information was in the request, the request takes different amounts of time to process.

The results are used to determine response time baselines, and to gauge hardware capacity under significant loads.

The test data (the many different possible entries in the request) are hard coded. This is what I'm trying to make more felxible, so I don't have specific examples and test cases hard coded in my functions.

This is the best explanation I can give. Again, thanks for your help!
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Ok. Sounds like you're doing performance testing, not unit testing, so JMeter (or possibly JUnitPerf, or Grinder) is probably a good pick for the tooling.
Tabitha Scott
Greenhorn

Joined: Jun 18, 2004
Posts: 5
Sounds good! Thank you once again for you help. I appreciate your time!

I have previously looked into JUnitPerf, and think it will be inadequate for the amount of testing I have in mind. (From JUnitPerf: "JUnitPerf is not intended to be a full-fledged load testing or performance profiling tool..." )

However, I haven't heard of The Grinder before, so I'll take a look at that.

Again, thank you to everyone who has contributed!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JUnit v Cactus?