随笔分类 -  软件测试

摘要:一、引入依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <d 阅读全文
posted @ 2021-04-12 15:43 残星 阅读(348) 评论(0) 推荐(0) 编辑
摘要:1.JUnit在TestCase中应用了模板方法模式:public void runBare() throws Throwable{ setUp(); try{ runTest(); }finally{ tearDown(); }}2.JUnit在TestCase类中应用了适配器(Adapter)模式:public void runBare()throws Throwable{ Throwable exception = null; setUp(); try { runTest(); } catch (Throwable running) { ... 阅读全文
posted @ 2011-12-14 16:08 残星 阅读(1039) 评论(0) 推荐(0) 编辑
摘要:1.JUnit4全面引入Annotation来执行我们编写的测试2.JUnit4并不要求测试类继承TestCase父类3.在一个测试类中,所有被@Test注解所修饰的public,void方法都是testcase,可以被JUnit所执行。4.虽然JUnit4并不要求测试方法名以test开头,但我们最好还是按照JUnit3.8的要求那样,以test作为测试方法的开头。5.在JUnit4中,通过@Before注解实现与JUnit3.8中的SetUp方法同样的功能,通过@After注解实现与JUnit3.8中的tearDown同样的功能。6.JUnit4中,可以使用@BeforeClass与Afte 阅读全文
posted @ 2011-12-14 12:18 残星 阅读(2126) 评论(0) 推荐(0) 编辑
摘要:一、在MyEclipse提供了对Junit的支持(无需引用第三方库):单击项目右键-->properties-->Java Build Path-->Libraries-->Add Library-->Junit-->next-->选择版本:Junit3/Junit4-->Finish-->OK二、使用Junit的最佳实践:1、新建一个名为test的Source Folder,用于存放测试类源代码。项目右键-->New-->Source Folder-->Folder Name:test-->finish.在测试目录 阅读全文
posted @ 2011-12-07 21:32 残星 阅读(1899) 评论(0) 推荐(0) 编辑