• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to test simple java method using StrutsTestCase  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have got a method in java file like this:
public boolean inserDB(String name, String Address){
// Gets the DB connection
// insers one record into Database and returns true/false
return boolean;
}
How can i write a test scrpt in StrutsTestCase?
We have got many similar methods, to perform all sorts of DB operations.
Now we need to write automated unit test cases. We thought of using StutsTestCase frame work.
Can any one help me.
Thanks,
Sripathi.
 
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about separating the two "comments" into separate methods so that you can replace the JDBC Connection object for testing purposes?
Something like this:

and
 
Sree Reddy
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much,
I will try to follow the same.
Bye,
Sree
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!