如何使用Struts执行Junit测试-Ibatis [英] How perform Junit tests with Struts - Ibatis

查看:84
本文介绍了如何使用Struts执行Junit测试-Ibatis的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Struts 1.2.x和Ibatis 2.x版本进行开发,所以我昨天完成了,现在我要执行测试,这是我第一次尝试使用JUnit,我已经进行了测试,但是在JavaApp上没有运行服务器,那么如何使用服务器行为模拟或生成模拟,建议将Struts和Ibatis内置环境使用wich模拟?

例如,如何设置登录屏幕的证书?

我知道使用StrutsTestCase即时通讯的情况,关于仙人掌是用于容器的,而对于非容器场景则是模拟的,我想使用struts和ibatis查看演示,因为我不知道如何从映射中检索数据.谢谢

对不起我的英语

提前谢谢!

解决方案

您是否看过HttpUnit?我在Servlet测试中尝试过它,它与Struts Actions完全不同,但我知道,但是它有一些不错的教程.

您可能还需要查看用于JUnit的StrutsTestCase .该项目应该是单元测试支撑的充分开始.它还提到仙人掌,这是一个用于在服务器端测试Web应用程序的框架.

实际上,这完全取决于您要进行测试的程度.您可能应该首先编写一个测试,即您知道的测试驱动设计;)它就可以了.并不是我一直都在做...

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!

解决方案

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...

这篇关于如何使用Struts执行Junit测试-Ibatis的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆