1. TestNg与Spring的集成
文章目录
- 被测试的类继承AbstractTestNGSpringContextTests类
- 添加注解指定Spring的ApplicationContext文件的路径
- 代码中添加Autowired注解获取Spring的bean
@ContextConfiguration(locations = {"classpath:ApplicationContext.xml"})
public class BwsTesting extends AbstractTestNGSpringContextTests {
@Autowired
private ProductBillDetailDaoImpl pbdai;
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论