aspose file tools*
The moose likes Beginning Java and the fly likes Simple test tool for functions 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 » Java » Beginning Java
Bookmark "Simple test tool for functions " Watch "Simple test tool for functions " New topic
Author

Simple test tool for functions

Piotr Wu
Greenhorn

Joined: Sep 29, 2011
Posts: 1
First of all I would like to say Hello to everyone as I am a newjoiner.


I am beginning my java trip right now.
Hence first question...

I am using Eclipse environment.
Let's assume I need to develop only one function, that will be implemented to some system.
For this I do not need a class, just a function with input parameters and return parameter.

The thing is that among the others I would like to pass arrays as parameters and return an array.

So let's say my function would be:


Now. ... I would like to test my function.
I could create a class then in code fill arrays aString1, aString2 and aString3 with data then pass them to my function.
But this is time consuming (not that I am a lazy guy :P )

I just just need to have possobility to increase/decrease number of params for my function along with number and content of items in arrays.
For every change I would need to re-code my class.

And finally ... my question

Is it possible to facilitate my testing with some Eclipse tool?
That I am able to test only my function(I should say method)
For example fill arrays through Grid components copy-pasting the contents right before launching the function?

I would really appreciate your tips.


Regards,
P.
Eric Mission
Greenhorn

Joined: Apr 22, 2009
Posts: 22
Let's assume I need to develop only one function, that will be implemented to some system.
For this I do not need a class, just a function with input parameters and return parameter.


All methods/functions have to sit inside something- hence a class file. If you don't need to instantiate an object then make the method static.

I could create a class then in code fill arrays aString1, aString2 and aString3 with data then pass them to my function.

Sounds like your making too much work for yourself though. Why not have 1 function that accepts a list of arrays?


Now, you can have as many arrays as you want passed in to a single method.

Is it possible to facilitate my testing with some Eclipse tool?

Try JUnit for unit testing.


to infinity and beyond
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Simple test tool for functions