Unit

android unit test

感情迁移 提交于 2020-03-20 23:30:42
3 月,跳不动了?>>> Android Unit and Integration testing:https://github.com/codepath/android_guides/wiki/Android-Unit-and-Integration-testing Unit Testing with JUnit - Tutorial: http://www.vogella.com/tutorials/JUnit/article.html Android application testing with the Android test framework - Tutorial :http://www.vogella.com/tutorials/AndroidTesting/article.html Robolectric Installation for Unit Testing:https://github.com/codepath/android_guides/wiki/Robolectric-Installation-for-Unit-Testing Android Button Example:http://www.mkyong.com/android/android-button-example/ https://code.google.com/p/robotium

Spring MVC Controller 单元测试

浪子不回头ぞ 提交于 2019-11-27 17:32:08
简介 Controller层的单元测试可以使得应用的可靠性得到提升,虽然这使得开发的时间有所增加,有得必失,这里我认为得到的比失去的多很多。 Sping MVC3.2版本之后的单元测试方法有所变化,随着功能的提升,单元测试更加的简单高效。 这里以4.1版本为例,记录Controller的单元测试流程。非常值得参考的是Spring MVC Showcase( https://github.com/spring-projects/spring-mvc-showcase ),它当前的版本使用的是4.1.0,以后会有所变动,为了使项目能够运行,请以它更新的配置为参考。 我用的IDE是IntelliJ IDEA13,我个人认为比Eclipse好用很多,是付费的,很贵! 项目结构 使用maven构建项目,项目结构如下: 在Controller层的测试不需要写单独的Spring config,可以直接使用src/main/java中的.xml 这里记录一下,Spring Mvc context的配置策略: 好多的小伙伴都会在一个文件(e.g spring-mvc.xml)中配置很多的东西,来看看showcase中web的配置结构 WEB-INF web.xml (文件) spring (文件夹) root-context.xml (文件,放置能够被servlet和filter共享使用的资源)