Skip to content
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

A way to apply JUnit's @Category to auto-generated tests from Compose Preview #662

Open
hellohj opened this issue Feb 27, 2025 · 4 comments

Comments

@hellohj
Copy link

hellohj commented Feb 27, 2025

Thank you for your help as always. This filter @category has resulted in a significant reduction in CI snapshot testing time.

While trying out Compose Preview auto-generated tests, I don't seem to find a way to add JUnit @Category filter because there is no actual written test. Do you have any ideas or suggestions how we only run snapshot tests without running other unit tests in a module for auto-generated snapshots? Would appreciate your insights.

@takahirom
Copy link
Owner

takahirom commented Feb 27, 2025

Thank you for reporting this. If you want to filter it, you can specify the test class like --test "com.github.takahirom.roborazzi.RoborazziPreviewParameterizedTests.test". Or we could use excludeTestsMatching() in Gradle DSL. But I think it might be good to have such a category.

We have some options to fix this:

  1. We could add a default Category like @Category(RoborazziComposablePreviewTestCategory::class). RoborazziComposablePreviewTestCategory will be in the Roborazzi library.
  2. Or we could add a Gradle DSL: roborazzi { testFunctionAnnotations = "@junit.Category(xxxx.xxxx.xxx.Xxx)" }
    Do you have any opinion on this?

@hellohj
Copy link
Author

hellohj commented Feb 27, 2025

Thanks for checking this out. Option 1 seems easiest for me, since I'm not very experienced with Gradle. We already use a custom Category class to filter tests, so adding 'RoborazziComposablePreviewTestCategory' would be pretty easy.

@hellohj
Copy link
Author

hellohj commented Mar 10, 2025

@takahirom Is there a timeline for this change? Thank you!

@takahirom
Copy link
Owner

Thanks. I'm planning to release a large update for Compose Preview support, and this update will conflict with that implementation, so we cannot work on this for now. Currently, we need a code review of the implementation—at least its architecture. If you have time to review it, it might help us expedite its release.
#633

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

No branches or pull requests

2 participants