• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple test tool for functions

 
Piotr Wu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic