Android&Mockito 模拟测试框架


1、Mockito 在 AndroidStudio 如何使用

http://www.tuicool.com/articles/YFfaamf


build.gradle

 
dependencies {  androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.0' } 
androidTest/java/…/MockitoSetupAndTest.java
 
public class MockitoSetupAndTest extends AndroidTestCase {   @Override  protected void setUp() throws Exception {  super.setUp();  System.setProperty("dexmaker.dexcache", getContext().getCacheDir().getPath());  }   public void testMockito() {  List mockedList = mock(List.class);   mockedList.add("one");  mockedList.clear();   verify(mockedList).add("one");  verify(mockedList).clear();  }  } 


2、Mockito的使用


http://www.oschina.net/translate/mockito-a-great-mock-framework-for-java-development

http://blog.csdn.net/sdyy321/article/details/38757135

http://segmentfault.com/a/1190000000407190



你可能感兴趣的:(Android&Mockito 模拟测试框架)