首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

扩充Spring junit4 的TestExecutionListener

2012-11-05 
扩展Spring junit4 的TestExecutionListenerweb单元测试经常会在执行前准备一些数据 执行完毕后删除这些数

扩展Spring junit4 的TestExecutionListener
web单元测试经常会在执行前准备一些数据
执行完毕后删除这些数据  如下伪代码



这样你的testcase只要继承JUnit4TestCase就可以使用BeforeMethod和AfterMethod了

附上BeforeMethod和AfterMethod

@Retention(RetentionPolicy.RUNTIME)@Target({ElementType.METHOD})public @interface BeforeMethod {String[] value() default {};}@Retention(RetentionPolicy.RUNTIME)@Target({ElementType.METHOD})public @interface AfterMethod {String[] value() default {};}


热点排行