Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Evaluate TestRequestBuilder.CustomFilters also on class, not just on test.#2209

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jan-varecka-signageos-io wants to merge2 commits intoandroid:main
base:main
Choose a base branch
Loading
fromjan-varecka-signageos-io:evaluateCustomFiltersOnClass

Conversation

@jan-varecka-signageos-io

NowTestRequestBuilder.CustomFilters does not evaluate@CustomFilter on test classes, just on tests. It will be great to have evaluation also for classes.

Because of this missing feature, I need to apply my annotation with@CustomFilter to every test method, or I have to configure instrumentation runner in build.gradle.kts (or in my custom runner). All these solutions are kind of painful in large multimodule project.

android {    defaultConfig {        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"        testInstrumentationRunnerArguments["filter"] = listOf(            "mypackage.MyCustomFilter",        ).joinToString(separator = ",")    }}

or

class MyAndroidJUnitRunner : AndroidJUnitRunner() {    override fun onCreate(arguments: Bundle) {        arguments.putString("filter", MyCustomFilter::class.java.name)        super.onCreate(arguments)    }}

Copy link
Collaborator

@brettchabotbrettchabot left a comment

Choose a reason for hiding this comment

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

Can you also add an entry to runner/android_junit_runner/CHANGELOG.md

Copy link

@consp1racyconsp1racy left a comment

Choose a reason for hiding this comment

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

I'm missing a test case where the annotation is both on the class and on the methods, with different values.

true { true, false, none } --> 2

publicvoidtestTwoSkip() {}
}

publicstaticclassSampleCustomFilterOnClassextendsAbstractFilter {

Choose a reason for hiding this comment

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

This test code esentially simulates consumer code. The consumer shouldn't need to override anything butevaluateTest for this PR to work on classes. And they don't, thanks to the changes inCustomFilters.shouldRun above.

This class shouldn't exist. Usages can be replaced by the existingSampleCustomFilter class.

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@CustomFilter(filterClass =SampleCustomFilterOnClass.class)
public @interfaceSampleCustomAnnotationOnClass {

Choose a reason for hiding this comment

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

This annotation shouldn't exist, it's essentially the same asSampleCustomAnnotation, just below.

@jan-varecka-signageos-iojan-varecka-signageos-io marked this pull request as draftMay 2, 2024 08:15
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@brettchabotbrettchabotbrettchabot left review comments

+1 more reviewer

@consp1racyconsp1racyconsp1racy requested changes

Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jan-varecka-signageos-io@brettchabot@consp1racy

[8]ページ先頭

©2009-2025 Movatter.jp