-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading annotation's parameters #9
Comments
ping? |
To me, this feels out of scope for dex-test-parser, since the information gathered isn't actually needed to determine which tests to run. We've had requests for this before (see #8 ) but I don't think it's something that dex-test-parser should be handling. One alternative solution for you, if you're always going to be building the test code before running tests, you could use an annotation processor to collect this information and write it to a file. |
re: out of scope for dex-test-parser: I have been playing with the code to implement this change myself. So far I didn't have issues parsing ints/boolean from the re: annotation processor: Other use cases I can think of include:
|
Yeah, there's a fair amount of stuff that needs to be parsed but ultimately isn't used, just because of how the code is written. I understand that it probably would be easy to add this, but I don't want this project to slowly grow into a full blown dex decompiler :) I already mentioned the annotation processor idea, but another one that we actually use for our tests is just to have the test itself write out any extra result info either to logcat or to a file on disk. Then after each test run, we pull that info off the device and process it. That approach also could cover your Test Rail use case. For portrait vs landscape, you can check out another open source project from Linkedin: Test Butler, which supports letting you set / change the orientation of the device directly from tests. |
@drewhannay if you are reading information after the test is run, I suppose that's dynamic information, not static as the problem I am trying to solve. I don't agree that parsing the annotation value is turning dex-test-parser into a dex decompiler, but you are the maintainer, so you will make the final call on what gets added and what does not. Do you mind answering how can I get the string value of the |
I haven't tried this, but I'm guessing your issue is that |
I have another use case of this feature which I think would be within the scope of determining which tests to run. I'm currently making use of the standard Junit Category annotation to separate out my tests. With this setup, the annotation name alone is not enough for me to determine whether or not to run the test. While I could create new annotations as a workaround, the standardized Category annotation is appealing because it can work for both my jvm and android tests. |
@drewhannay I missed your msg. @adecker89 thanks for the reminder :) @drewhannay I tried to do what you said, but I couldn't make it work.
I added some logs around
if I replace the id "1" for a longer string like "hello world!"
It seems like the byte array contains an address instead of the full value... |
@Macarse Check this part of the dex format spec for the exact details of how these bytes are encoded. It looks like it varies based on the type of data in the @adecker89 Okay, I agree, that's probably a reasonable use case. And since it also helps solve @Macarse 's use case, I'd be okay with adding this feature. If @Macarse gets it working and wants to send a pull request, that'd be great (otherwise I can work on this at some point in the future, not sure when I'd get to it). |
This is what I know so far: Based on the docs, if the encoded value is As you can see from my logs, the Playing a bit with the code, I did the following:
as a result I got:
I played with my ByteArray to match that 13630 and I got the correct logic by doing:
The name of the field is also parsable by doing:
@drewhannay how would you like to change the API? I was thinking of modifying: and returning a so something like:
would end up being:
|
Sorry for the delay again. @kkoser from my team has been working on this and should have a PR soon. |
Hey super sorry! I had to step away from this for a bit, but I'm back now and I will have this up by Friday. Sorry again! |
See #11 |
Is this issue safe to close? It looks like the PR was merged. |
Yep, good call. |
Thanks! |
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 anannotations: List<Annotation>
instead ofannotationNames: List<String>
whereAnnotation
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:
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.
The text was updated successfully, but these errors were encountered: