问题
im using Struts 1.2.x and Ibatis 2.x version for development, so i finish yesterday and now i want to perform test this is my first time trying to work with JUnit, I already make test but in JavaApp not running on server, so how can I simulate or generate mocks with server behavior, and wich mocks are recommended for Struts and Ibatis built-in Environment?
for example how can i set accerts for login screen?
I know about StrutsTestCase im using it, and about Cactus are for containers and mocking for non containers scenaries, i want to view a demo using struts and ibatis cause I dont know how to retrieve data from mapping. Thanks
sorry about my English
Thanks in advance!
回答1:
Have you looked at HttpUnit? I tried it for Servlet testing, completely different from Struts Actions and such - I know, but it had some decent tutorials.
You also might want to look at StrutsTestCase for JUnit. That project should be a sufficient start for unit testing struts. It also mentions Cactus, which is a framework for testing web applications on the server side.
Actually it all depends on how far you want to go with testing. You probably should have started with writing a test first, Test Driven Design you know ;) It just works. Not that I do it all the time...
来源:https://stackoverflow.com/questions/491503/how-perform-junit-tests-with-struts-ibatis