Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Add coverage report #148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Add coverage report #148

wants to merge 3 commits into from

Conversation

tokou
Copy link

@tokou tokou commented Jun 3, 2018

Fixes #123

names = arrayOf("--coverage"),
required = false,
arity = 1,
description = "Either `true` or `false` to enable/disable test coverage collection. `false` by default.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a note that it doesn't turn on code coverage in the tests but just collects it?

README needs to be updated too btw

@@ -111,15 +113,25 @@ private fun runAllTests(args: Args, testPackage: TestPackage.Valid, testRunner:
val installTimeout = Pair(args.installTimeoutSeconds, TimeUnit.SECONDS)
val installAppApk = device.installApk(pathToApk = args.appApkPath, timeout = installTimeout)
val installTestApk = device.installApk(pathToApk = args.testApkPath, timeout = installTimeout)
val coverageDir = "/storage/emulated/0/app_coverage/${testPackage.value}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we use EXTERNAL_STORAGE environment variable instead of hardcoding external storage directory?

@@ -0,0 +1,5 @@
package com.gojuno.composer

val EXTERNAL_STORAGE = "/storage/emulated/0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant retrieving the actual value from environment on device using something like adb shell printenv EXTERNAL_STORAGE.
AFAIR it is mandatory: https://source.android.com/devices/storage/config-example

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw I guess we can have this code in commander

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need me to try and do this or will you add something more generic to commander ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add it to commander now

@tokou
Copy link
Author

tokou commented Jun 14, 2018

Related: #151

private fun buildCoverageArguments(coverage: Boolean, coverageDir: String): List<Pair<String, String>> =
if (coverage) listOf(
"coverage" to "true",
"coverageFile" to "$coverageDir/coverage.ec"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be coverageFilePath when running with testOrchestrator and then we will have to pull down .ec for each test case.

@danielgomezrico
Copy link

@tokou Any reason why this wasn't merged yet?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants