This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'jacoco' | |
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) { | |
reports { | |
xml.enabled = true | |
html.enabled = true | |
} | |
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'jacoco' | |
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { | |
reports { | |
xml.enabled = true | |
html.enabled = true | |
} | |
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'jacoco' | |
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') { | |
reports { | |
xml.enabled = true | |
html.enabled = true | |
} | |
jacocoClasspath = configurations['androidJacocoAnt'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(RobolectricTestRunner.class) | |
@Config(constants = BuildConfig.class, sdk = 22) | |
public class MainActivityTest { | |
@Test | |
public void shouldHideButtonAfterClick() { | |
MainActivity activity = Robolectric.setupActivity(MainActivity.class); | |
Button button = (Button) activity.findViewById(R.id.hide); | |
button.performClick(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
buildTypes { | |
debug { | |
testCoverageEnabled true | |
} | |
... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4.class) | |
@LargeTest | |
public class MainActivityTest { | |
@Rule | |
public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); | |
@Test | |
public void shouldUpdateTextAfterButtonClick() { | |
onView(withId(R.id.button)).perform(click()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical"> | |
<TextView | |
android:id="@+id/text" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity implements View.OnClickListener { | |
private TextView text; | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
findViewById(R.id.button).setOnClickListener(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
lintConfig { | |
lintConfig file("${project.rootDir}/config/lint.xml") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<lint> | |
<issue id="InvalidPackage" severity="ignore" /> | |
</lint> |