Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing test case without database operations  RSS feed

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to write test case for classes that calls database operations using entity beans and data of test case should be read from or write into some xml file?
How to use mock objects here?
The application is J2EE based uses EJBs and back end as db2.
Any examples available?

Thanks
Deepa
 
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are these BMP or CMP entity beans?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Deepa More:
data of test case should be read from or write into some xml file?


Regarding reading the data... If you're using JUnit 3.8, see here for an example of how to write data-driven test cases. If you're using JUnit 4.x, see this instead.

I'm not sure, though, what would you like to write into the XML file?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!