Skip to content

Commit

Permalink
try coverage folder with test name
Browse files Browse the repository at this point in the history
  • Loading branch information
karthyks committed Oct 9, 2023
1 parent 9709a68 commit da331ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ abstract class BaseAndroidDevice(
FileSyncEntry(
relativePath = "coverage",
pathRoot = PathRoot.APP_DATA,
aggregationMode = AggregationMode.POOL
aggregationMode = AggregationMode.TEST_RUN
)
)
}
Expand Down Expand Up @@ -269,7 +269,7 @@ abstract class BaseAndroidDevice(
)

val fileSyncTestRunListener =
FileSyncTestRunListener(devicePoolId, this, this@BaseAndroidDevice.androidConfiguration.fileSyncConfiguration, fileManager)
FileSyncTestRunListener(devicePoolId, this, this@BaseAndroidDevice.androidConfiguration.fileSyncConfiguration, fileManager, testBatch)

val adamScreenCaptureTestRunListener = AdamScreenCaptureTestRunListener(devicePoolId, this, fileManager, testBatch.id)
attachmentProviders.add(adamScreenCaptureTestRunListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import com.malinskiy.marathon.device.toDeviceInfo
import com.malinskiy.marathon.io.FileManager
import com.malinskiy.marathon.io.FolderType
import com.malinskiy.marathon.log.MarathonLogging
import com.malinskiy.marathon.test.TestBatch
import java.io.File

class FileSyncTestRunListener(
private val pool: DevicePoolId,
private val device: AndroidDevice,
private val configuration: FileSyncConfiguration,
private val fileManager: FileManager,
private val testBatch: TestBatch = TestBatch(tests = emptyList()),
) : AndroidTestRunListener {

private val logger = MarathonLogging.logger("FileSyncTestRunListener")
Expand Down Expand Up @@ -106,7 +108,11 @@ class FileSyncTestRunListener(
AggregationMode.TEST_RUN -> fileManager.createFolder(FolderType.DEVICE_FILES)
}

val basename = entry.relativePath.removeSuffix("/").substringAfterLast('/')
var basename = entry.relativePath.removeSuffix("/").substringAfterLast('/')
if (testBatch.tests.size == 1) {
val test = testBatch.tests.first()
basename.plus("/${test.pkg}.${test.clazz}#${test.method}")
}
val subfolder = File(localFolder, basename).apply { mkdirs() }
logger.debug { "Pulling into ${subfolder.absolutePath}" }
when (entry.pathRoot) {
Expand Down

0 comments on commit da331ab

Please sign in to comment.