linkedin / dex-test-parser Goto Github PK
View Code? Open in Web Editor NEWFind all test methods in an Android instrumentation APK
License: BSD 2-Clause "Simplified" License
Find all test methods in an Android instrumentation APK
License: BSD 2-Clause "Simplified" License
We are getting the following exception when running the DexParser via Flank:
Exception in thread "main" com.linkedin.dex.spec.DexException: invalid LEB128 sequence
at com.linkedin.dex.spec.Leb128$Companion.readUnsignedLeb128(Leb128.kt:26)
at com.linkedin.dex.parser.DecodedValue$Companion.create(DecodedValue.kt:56)
at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:70)
at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
at com.linkedin.dex.parser.TestMethodKt.createTestMethods(TestMethod.kt:42)
at com.linkedin.dex.parser.JUnit4ExtensionsKt.findAllJUnit4Tests(JUnit4Extensions.kt:35)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:60)
at com.linkedin.dex.parser.DexParser$Companion.findTestNames(DexParser.kt:45)
at com.linkedin.dex.parser.DexParser$Companion.main(DexParser.kt:36)
at com.linkedin.dex.parser.DexParser.main(DexParser.kt)
I put a screenshot of what the debugger looks like when the exception is thrown below. How would I go about debugging what the issue is. Thank you!
The same as #70.
Reproduced with AGP 7.0.4, 7.1.1. When compileSdkVersion is set to 31. Everything works great when compileSdkVersion is 30.
R8 version is 3.1.51 (AGP 7.1.1 one).
This blocks us from upgrading a lot of dependencies, including upgrading Kotlin to the latest version.
We run Flank using Java 11.
java.nio.BufferUnderflowException
at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:651)
at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:402)
at com.linkedin.dex.spec.AnnotationOffItem.<init>(AnnotationOffItem.kt:13)
at com.linkedin.dex.spec.AnnotationSetItem$Companion.create(AnnotationSetItem.kt:18)
at com.linkedin.dex.parser.AnnotationUtilsKt.checkIfAnnotationIsInherited(AnnotationUtils.kt:89)
at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:77)
at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
at ftl.run.platform.android.CreateAndroidTestContextKt.isParametrizedClass(CreateAndroidTestContext.kt:210)
at ftl.run.platform.android.CreateAndroidTestContextKt.getParametrizedClasses(CreateAndroidTestContext.kt:200)
at ftl.run.platform.android.CreateAndroidTestContextKt.getFlankTestMethods(CreateAndroidTestContext.kt:153)
at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShardsNormally(CreateAndroidTestContext.kt:86)
at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShards(CreateAndroidTestContext.kt:112)
at ftl.run.platform.android.CreateAndroidTestContextKt.access$calculateShards(CreateAndroidTestContext.kt:1)
at ftl.run.platform.android.CreateAndroidTestContextKt$setupShards$2$1$1.invokeSuspend(CreateAndroidTestContext.kt:49)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at ftl.presentation.RunStateKt.runBlockingWithObservingRunState(RunState.kt:17)
at ftl.domain.RunTestAndroidKt.invoke(RunTestAndroid.kt:63)
at ftl.presentation.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:58)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ftl.Main$main$1.invoke(Main.kt:12)
at ftl.Main$main$1.invoke(Main.kt:10)
at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:28)
at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:17)
at ftl.Main.main(Main.kt:10)
I've got some test apks that I use locally to test changes to dex-test-parser, but there really should be an Android app module checked in that has a comprehensive set of JUnit 3 and JUnit 4 tests, in both Java and Kotlin, so that we can have automated tests for the project.
Now that #32 has been merged, it'd be great to have a new release. ๐
SDK 28 is breaking dex test parser.
minSdkVersion 28
Caused by: com.linkedin.dex.spec.DexException: Invalid dexMagic:
DexMagic(dex=[100, 101, 120], newline=10, version=[48, 51, 57], zero=0)
at com.linkedin.dex.spec.DexMagic.validate(DexMagic.kt:37)
at com.linkedin.dex.spec.HeaderItem.validate(HeaderItem.kt:62)
at com.linkedin.dex.spec.DexFile.<init>(DexFile.kt:35)
at com.linkedin.dex.parser.DexParser$Companion$readDexFiles$1$4.invoke(DexParser.kt:73)
at com.linkedin.dex.parser.DexParser$Companion$readDexFiles$1$4.invoke(DexParser.kt:23)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:174)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:691)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:721)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:712)
at com.linkedin.dex.parser.DexParser$Companion.readDexFiles(DexParser.kt:74)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:57)
at ftl.args.AndroidArgs.getTestMethods(AndroidArgs.kt:113)
at ftl.args.AndroidArgs.access$getTestMethods(AndroidArgs.kt:36)
at ftl.args.AndroidArgs$testShardChunks$2.invoke(AndroidArgs.kt:87)
at ftl.args.AndroidArgs$testShardChunks$2.invoke(AndroidArgs.kt:36)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at ftl.args.AndroidArgs.getTestShardChunks(AndroidArgs.kt)
at ftl.run.AndroidTestRunner$runTests$2.invokeSuspend(AndroidTestRunner.kt:30)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.ResumeModeKt.resumeUninterceptedMode(ResumeMode.kt:45)
at kotlinx.coroutines.internal.ScopeCoroutine.onCompletionInternal$kotlinx_coroutines_core(Scopes.kt:28)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:305)
at kotlinx.coroutines.JobSupport.tryFinalizeFinishingState(JobSupport.kt:230)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:799)
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:742)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:117)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.kt:116)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:76)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:53)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:35)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at ftl.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:34)
at picocli.CommandLine.execute(CommandLine.java:1160)
... 9 more
Since #37 has been merged, would it be possible to get a new release ?
We have a weird test structure where we have Kotlin interfaces implementing test methods as default implementations. The actual test classes implement those interfaces. Unfortunately the default methods in the interfaces are also returned by findTestMethods
.
I would like to get an extension to #1
Apart from having the annotation, I would like to be able to read the parameters.
TestMethod
could have an annotations: List<Annotation>
instead of annotationNames: List<String>
where Annotation
contains the name + parameters dictionary.
Use case:
We are using Test Rail to track our regressions.
We would like to start moving as much as manual testing to automation as we can.
The idea is annotating test methods with an id to be able to update the test rail regression run with a pass/failure.
Example:
Android app will contain a test like this:
public class BasicJUnit4WithAnnotations {
@Test
@TestRail(id=1337)
public void basicJUnit4WithAnnotations() {
// Test something
}
}
We would use a script which would create a dictionary of test class -> testRail id.
Example:
"com.linkedin.parser.test.junit3.java.JUnit3WithAnnotations#testJUnit3WithAnnotations":1337
We would run all the tests annotated with TestRail (we are using Flank: https://github.com/TestArmada/flank)
We would update testRail using the map created in 2) and the result from the automation run.
PS: I know I can add the id to the name of the method but I would prefer using the annotation since it's cleaner.
For a while Iโve been trying to debug why I get invalid LEB128 sequence
when working with some test apks. From what I can tell this occurs more often with binaries built with java 7 compatibility. It doesn't occur with binaries built with java 8 compatibility.
I created a sample repo with two almost identical applications with the only difference being the compile compatibility.
invalid LEB128 sequence
com.linkedin.dex.spec.DexException: invalid LEB128 sequence
at com.linkedin.dex.spec.Leb128$Companion.readUnsignedLeb128(Leb128.kt:26)
at com.linkedin.dex.parser.DecodedValue$Companion.create(DecodedValue.kt:56)
at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:70)
at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
at com.linkedin.dex.parser.TestMethodKt.createTestMethods(TestMethod.kt:42)
at com.linkedin.dex.parser.JUnit4ExtensionsKt.findAllJUnit4Tests(JUnit4Extensions.kt:35)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:60)
Repo is available here:
https://github.com/carlospaulino/dex-test-parser-bug
Hello there, I am using Flank to run UI Tests on Firebase Test Lab, and when I run proguard over my build I get this error that seems related to this library.
I am using AGP 4.4.2. I tried to create a minimal repro project, but I couldn't.
Would you have any ideas of what can be happening ?
RunTests
java.nio.BufferUnderflowException
at java.base/java.nio.Buffer.nextGetIndex(Buffer.java:650)
at java.base/java.nio.HeapByteBuffer.getInt(HeapByteBuffer.java:400)
at com.linkedin.dex.spec.AnnotationOffItem.<init>(AnnotationOffItem.kt:13)
at com.linkedin.dex.spec.AnnotationSetItem$Companion.create(AnnotationSetItem.kt:18)
at com.linkedin.dex.parser.AnnotationUtilsKt.checkIfAnnotationIsInherited(AnnotationUtils.kt:89)
at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:77)
at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
Total run duration: 0m 10s
- Preparation: 0m 7s
at ftl.run.platform.android.CreateAndroidTestContextKt.isParametrizedClass(CreateAndroidTestContext.kt:210)
at ftl.run.platform.android.CreateAndroidTestContextKt.getParametrizedClasses(CreateAndroidTestContext.kt:200)
at ftl.run.platform.android.CreateAndroidTestContextKt.getFlankTestMethods(CreateAndroidTestContext.kt:153)
at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShardsNormally(CreateAndroidTestContext.kt:86)
at ftl.run.platform.android.CreateAndroidTestContextKt.calculateShards(CreateAndroidTestContext.kt:112)
at ftl.run.platform.android.CreateAndroidTestContextKt.access$calculateShards(CreateAndroidTestContext.kt:1)
at ftl.run.platform.android.CreateAndroidTestContextKt$setupShards$2$1$1.invokeSuspend(CreateAndroidTestContext.kt:49)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at ftl.domain.RunTestAndroidKt.invoke(RunTestAndroid.kt:62)
at ftl.presentation.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:54)
at picocli.CommandLine.executeUserObject(CommandLine.java:1939)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at ftl.Main$main$1.invoke(Main.kt:12)
at ftl.Main$main$1.invoke(Main.kt:10)
at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:28)
at ftl.run.exception.ExceptionHandlerKt.withGlobalExceptionHandling(ExceptionHandler.kt:17)
at ftl.Main.main(Main.kt:10)
It'd be nice if the artifact was published to maven central.
Could not find com.linkedin.dextestparser:parser:2.0.1.
Searched in the following locations:
- https://maven-central.storage-download.googleapis.com/repos/central/data/com/linkedin/dextestparser/parser/2.0.1/parser-2.0.1.pom
- https://maven-central.storage-download.googleapis.com/repos/central/data/com/linkedin/dextestparser/parser/2.0.1/parser-2.0.1.jar
Required by:
project :
I think bintray can even automate this for you:
https://blog.bintray.com/2014/02/11/bintray-as-pain-free-gateway-to-maven-central/
The project dependencies are extremely out of date and there are no instructions on how to get it to run locally.
I tried Android Studio, but it just wouldn't build.
Android Studio -> Import Project -> Gradle Project
Thanks for building this! We're planning on using this as part of our test process and I was wondering, we can fetch annotation names but how about their values? "@ Foo("Bar")". I've just pulled down the code and was planning on investigating myself but just wanted to check in and see if there was anything that stopped you?
Consider this change:
diff --git a/test-app/src/androidTest/java/com/linkedin/parser/test/junit4/java/AbstractTest.java b/test-app/src/androidTest/java/com/linkedin/parser/test/junit4/java/AbstractTest.java
index 81dc312..70b1018 100644
--- a/test-app/src/androidTest/java/com/linkedin/parser/test/junit4/java/AbstractTest.java
+++ b/test-app/src/androidTest/java/com/linkedin/parser/test/junit4/java/AbstractTest.java
@@ -1,5 +1,6 @@
package com.linkedin.parser.test.junit4.java;
+import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
@@ -7,6 +8,7 @@ import static org.junit.Assert.assertTrue;
public abstract class AbstractTest {
@Test
+ @Ignore
public void abstractTest() {
assertTrue(true);
}
in the output com.linkedin.parser.test.junit4.java.ConcreteTest#abstractTest
should have both org.junit.Ignore
and org.junit.Test
applied (present in annotations
property), but it actually has none.
It'd be great to have a new release now that #14 has been merged.
My annotation classes look like this -
import java.lang.annotation.Inherited
@Target(AnnotationTarget.CLASS)
@Inherited
internal annotation class ScreenshotTest
@Target(AnnotationTarget.CLASS)
internal annotation class EspressoTest
For a test structure like this -
@ScreenshotTest
abstract class BaseScreenshotTest
class ScreenshotTestA : BaseScreenshotTest
abstract class BaseEspressoTest
@EspressoTest
class EspressoTestA : BaseEspressoTest
@EspressoTest
class EspressoTestA : BaseEspressoTest
Using adb shell am instrument -w -e annotation 'com.company.mobile.ScreenshotTest
works as expected and picks up ScreenshotTestA
.
However, when using dex-parser, the @Test
methods in ScreenshotTestA
don't have the @ScreenshotTest
annotation.
To get around it, instead of only having the annotation on a base class, we have to do away with the @Inherited
annotation and manually annotate every class, like in the @EspressoTest
example.
It would be amazing if dex parser could also detect and return the @Inherited
annotations along with those on the class.
I rebuild the project from source and when trying to use java -jar
the command-line fails.
Steps to reproduce:
./gradlew clean build
java -jar parser/build/distributions/parser-2.0.1-SNAPSHOT/lib/parser-2.0.1-SNAPSHOT.jar test-app/build/outputs/apk/test-app-debug-androidTest.apk ./
Error
no main manifest attribute, in parser/build/distributions/parser-2.0.1-SNAPSHOT/lib/parser-2.0.1-SNAPSHOT.jar
Environment
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
Was looking to get support for the Parameterized
runners. Currently this is an issue in Flank (Flank/flank#61) but it sounds like the support for this type of runner needs to be enabled here first.
When using this library on a test apk which contains kotlin interfaces with methods annotated with @Test
, this library will put the fully qualified name for this interface, when it shouldn't (it's not a runnable test unless you have a real class implementing it)
Since instrumentation allows filtering by annotation, it would be useful to include list of all annotations for each test method and the whole test class.
Also, in what format should the data be stored? CSV with different separators for columns and lists, or maybe JSON?
I think it's a bug that this test is detected as valid.
public abstract class TeacherTest {
@Test
public abstract void displaysPageObjects();
}
java.lang.InstantiationException: Can't instantiate abstract class com.instructure.teacher.ui.utils.TeacherTest
Hi,
We use this library for extracting tests to run from apks and we have recently noticed that parsed test count is not stable. We run it on CI and sometimes a few test methods are not parsed. After some investigation, it turns out that these methods are defined in base test classes.
I checked two apks: the first one where we don't have tests from a base class and the second one where these tests were parsed successfully. Hashes of the apks are different but if you unpack them and compare the hashes of the contents they are absolutely identical. Hashes of all the dex files are the same. The only difference that I found is the order of dex files how they appear in zip archive :)
So the problem is that base class was defined in classes4.dex
and the concrete implementation is in classes2.dex
. The order of the dex files in the archive is completely random each time when you package the apk. Not sure is this a violation of dex specification or not because in the specs there is no info about multidex and I can't find any specs specifically for multidex.
We use AGP 3.5.1. Has anyone encountered this problem?
Looks like we can't rely on the order of classes/superclasses when we have multiple dex files, so we need to have multiple passes. What do you think about it? I will create a PR soon with the fixes
After updating Flank to use dex-test parser 2.1.0
@gtroshin reported this crash.
val allTestMethods = DexParser.findTestMethods(testLocalApk)
Flank is calling findTestMethods
which fails. I think this is a bug in dex-test-parser
Here's the full stack trace:
RunTests
Uploading x-google-debug.apk .
Uploading x-google-debug-androidTest.apk .
Exception in thread "main" picocli.CommandLine$ExecutionException: Error while running command (ftl.cli.firebase.test.android.AndroidRunCommand@40e4ea87): java.lang.RuntimeException: What a Terrible Failure: Ljava/lang/annotation/Inherited; annotation is not found in the test output
at picocli.CommandLine.execute(CommandLine.java:1168)
at picocli.CommandLine.access$800(CommandLine.java:141)
at picocli.CommandLine$RunLast.handle(CommandLine.java:1367)
at picocli.CommandLine$RunLast.handle(CommandLine.java:1335)
at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1243)
at picocli.CommandLine.parseWithHandlers(CommandLine.java:1526)
at picocli.CommandLine.run(CommandLine.java:1974)
at picocli.CommandLine.run(CommandLine.java:1920)
at ftl.Main$Companion.main(Main.kt:41)
at ftl.Main.main(Main.kt)
Caused by: java.lang.RuntimeException: What a Terrible Failure: Ljava/lang/annotation/Inherited; annotation is not found in the test output
at com.linkedin.dex.spec.DexFile$inheritedAnnotationTypeIdIndex$2.invoke(DexFile.kt:52)
at com.linkedin.dex.spec.DexFile$inheritedAnnotationTypeIdIndex$2.invoke(DexFile.kt:11)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.linkedin.dex.spec.DexFile.getInheritedAnnotationTypeIdIndex(DexFile.kt)
at com.linkedin.dex.parser.AnnotationUtilsKt.checkIfAnnotationIsInherited(AnnotationUtils.kt:88)
at com.linkedin.dex.parser.AnnotationUtilsKt.getTestAnnotation(AnnotationUtils.kt:77)
at com.linkedin.dex.parser.AnnotationUtilsKt.getClassAnnotationValues(AnnotationUtils.kt:46)
at com.linkedin.dex.parser.TestMethodKt.createTestMethods(TestMethod.kt:42)
at com.linkedin.dex.parser.JUnit4ExtensionsKt.findAllJUnit4Tests(JUnit4Extensions.kt:35)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:60)
at ftl.args.AndroidArgs.getTestMethods(AndroidArgs.kt:116)
at ftl.args.AndroidArgs.access$getTestMethods(AndroidArgs.kt:38)
at ftl.args.AndroidArgs$testShardChunks$2.invoke(AndroidArgs.kt:90)
at ftl.args.AndroidArgs$testShardChunks$2.invoke(AndroidArgs.kt:38)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at ftl.args.AndroidArgs.getTestShardChunks(AndroidArgs.kt)
at ftl.run.AndroidTestRunner$runTests$2.invokeSuspend(AndroidTestRunner.kt:30)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32)
at kotlinx.coroutines.ResumeModeKt.resumeUninterceptedMode(ResumeMode.kt:45)
at kotlinx.coroutines.internal.ScopeCoroutine.onCompletionInternal$kotlinx_coroutines_core(Scopes.kt:28)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:305)
at kotlinx.coroutines.JobSupport.tryFinalizeFinishingState(JobSupport.kt:230)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:799)
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.kt:742)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:117)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:45)
at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.kt:116)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:76)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:53)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:35)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at ftl.cli.firebase.test.android.AndroidRunCommand.run(AndroidRunCommand.kt:34)
at picocli.CommandLine.execute(CommandLine.java:1160)
... 9 more
Hi. Could you please help me to get the list of all test classes inside SuiteClasses annotation? I didn't find the way to do it.
@RunWith(Suite::class)
@Suite.SuiteClasses(
TestClassA::class,
TestClassB::class,
TestClassC::class
)
class AllSmokeSuite
For example, in case above I would like to get TestClassA, TestClassB and TestClassC. After that I want to filter my tests and run only test from these classes.
So, the main purpose is to run the tests of AllSmokeSuite.
Please ignore, testing triaging
Hi,
I found this crash in the Flank test runner project, but it appears to be coming from the dependency with this project. I get the following crash on apks built with minSdkVersion 24 or greater:
DexMagic(dex=[100, 101, 120], newline=10, version=[48, 51, 53], zero=0)
at com.linkedin.dex.spec.DexMagic.validate(DexMagic.kt:31)
at com.linkedin.dex.spec.HeaderItem.validate(HeaderItem.kt:62)
at com.linkedin.dex.spec.DexFile.<init>(DexFile.kt:35)
at com.linkedin.dex.parser.DexParser$Companion$readDexFiles$1$4.invoke(DexParser.kt:79)
at com.linkedin.dex.parser.DexParser$Companion$readDexFiles$1$4.invoke(DexParser.kt:23)
at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:147)
at kotlin.sequences.SequencesKt___SequencesKt.toCollection(_Sequences.kt:630)
at kotlin.sequences.SequencesKt___SequencesKt.toMutableList(_Sequences.kt:660)
at kotlin.sequences.SequencesKt___SequencesKt.toList(_Sequences.kt:651)
at com.linkedin.dex.parser.DexParser$Companion.readDexFiles(DexParser.kt:80)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:58)
at com.linkedin.dex.parser.DexParser.findTestMethods(DexParser.kt)
at com.walmart.otto.Flank.getTestCaseNames(Flank.java:268)
at com.walmart.otto.Flank.start(Flank.java:71)
at com.walmart.otto.Flank.main(Flank.java:118)
As an upstream user of this project, thanks for all your hard work! By the way I posted the Flank issue here Flank/flank#165
It'd be great to have a new release to capture the latest fixes on master. I'd like to use this in Flank.
When using this library on a test APK I have the following error:
Exception in thread "main" java.nio.BufferOverflowException
at java.nio.Buffer.nextPutIndex(Buffer.java:521)
at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:169)
at com.linkedin.dex.spec.EncodedValue$Companion.getPaddedBufferToTheRight(EncodedValue.kt:116)
at com.linkedin.dex.spec.EncodedValue$Companion.create(EncodedValue.kt:62)
at com.linkedin.dex.spec.AnnotationElement.<init>(AnnotationElement.kt:13)
at com.linkedin.dex.spec.EncodedAnnotation$Companion.create(EncodedAnnotation.kt:18)
at com.linkedin.dex.spec.AnnotationItem$Companion.create(AnnotationItem.kt:17)
at com.linkedin.dex.parser.AnnotationUtilsKt.getMethodAnnotationValues(AnnotationUtils.kt:60)
at com.linkedin.dex.parser.TestMethodKt.createTestMethod(TestMethod.kt:53)
at com.linkedin.dex.parser.TestMethodKt.createTestMethods(TestMethod.kt:46)
at com.linkedin.dex.parser.JUnit4ExtensionsKt.findAllJUnit4Tests(JUnit4Extensions.kt:35)
at com.linkedin.dex.parser.DexParser$Companion.findTestMethods(DexParser.kt:60)
at com.linkedin.dex.parser.DexParser$Companion.findTestNames(DexParser.kt:45)
at com.linkedin.dex.parser.DexParser$Companion.main(DexParser.kt:36)
at com.linkedin.dex.parser.DexParser.main(DexParser.kt)
Investigating this issue, I found this function.
private fun getPaddedBufferToTheRight(byteBuffer: ByteBuffer, size: Int, fullSize: Int): ByteBuffer
It allocates a HeapByteBuffer
with capacity equals fullSize
value.
What is a problem when the value of variable size
is negative, because in this line it will try to put (fullSize - size)
bytes, inside for-loop.
For instance:
In my case, the function getPaddedBufferToTheRight
was called with values:
size
= -3fullSize
= 8It will allocate a HeapByteBuffer
with capacity 8, but it will try to put 11 bytes, because for (x in size + 1..fullSize)
.
Possible solution:
This issue can be fixed by changing the capacity of the buffer.
Instead of capacity equals fullSize
:
val buffer = ByteBuffer.allocate(fullSize)
We can change this code to adjust the capacity, using the size
variable too:
val capacity = fullSize + Math.abs(Math.min(size, 0))
val buffer = ByteBuffer.allocate(capacity)
This approach just will ignore the annotation attribute value, that will be filled with zero. :/
More details:
This problem occurs due to the use of CircularProgressBar library.
It defines the method getBackgroundStrokeWidth that has the annotation @FloatRange.
This annotation defines four attributes, where two of them are double (from
and to
), but in the library, it uses the annotation as a float with Float.MAX_VALUE
, what causes the issue.
The problem only occurs if we use the constants Float.MAX_VALUE
or Double.MAX_VALUE
.
Sorry for the spam!
println("Found $count fully qualified test methods")
}
println("Finished in $time ms")
These printlns always execute. There should be a way to toggle them off.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.