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

Add section to robolectric.org about profiling Robolectric tests using Android Studio or Gradle (e.g. using YoutKit) #8876

Open
hoisie opened this issue Feb 26, 2024 · 12 comments
Labels
help wanted starter issue Small/simple issues for new contributors

Comments

@hoisie
Copy link
Contributor

hoisie commented Feb 26, 2024

This would be part of robolectric.github.io.

People often run into performance or memory issues with Robolectric, so it would be nice to have a section detailing how to profile Robolectric tests from either inside of Android Studio or through Gradle + VirualVM.

@hoisie hoisie added help wanted starter issue Small/simple issues for new contributors labels Feb 26, 2024
@shashankiitbhu
Copy link

Is there already some documentation about how to profile Robolectric tests using Android Studio? or should we make one from scratch by performing profiling and taking screenshots for every major step?

@hoisie
Copy link
Contributor Author

hoisie commented Feb 27, 2024

Hi @shashankiitbhu, thanks for taking interest in this issue.

The last time I used YourKit (like 3 years ago), the process was something like:

  1. Download and extract YourKit into your home directory
  2. Add the following JVM args using gradle: -agentpath:$HOME/yourkit/bin/linux-x86-64/libyjpagent.so=disablestacktelemetry,exceptions=disable,onexit=snapshot,sampling

However, it's possible that the flags have changed.

@shashankiitbhu
Copy link

shashankiitbhu commented Mar 2, 2024

@hoisie Do we need to add section for both using Android Studio or Gradle (e.g. using YoutKit) or just Android Studio would work?

also, should I make a PR directly on robolectric.github.io ? adding a file profiling-tests.md ?

@utzcoz
Copy link
Member

utzcoz commented Mar 2, 2024

@shashankiitbhu Actually, we have added it before, but I removed it some months ago as Android Studio can provides the clear information that it doesn't support the newer AGP version, and it's very common and the rule has been used by Google at least 1-2 years. And Gradle version is set by gradle wrapper, and the gradlew will download it for all OSes automatically when we run ./gradlew assemble, so it's another common rule used by Android area. IMO, it's not very hard for an developer who is familiar with Android development to select the correct Android Studio version.

There is another issue that if we want to full tests of Robolectric itself, there is a requirement for the memory of the development machine, and the best recommended pack is 16GB+ memory.

@utzcoz
Copy link
Member

utzcoz commented Mar 2, 2024

But many statements of https://robolectric.org/building-robolectric/ is outdated, as we has used JDK17+ and removed the building of native library to AOSP parts. If you want to update it, it's a great starting.

@shashankiitbhu
Copy link

@utzcoz so should I start with updating https://robolectric.org/building-robolectric/

With the latest information? Any instructions on where to start in this first? and which sections need to be updated first?

@utzcoz
Copy link
Member

utzcoz commented Mar 4, 2024

@shashankiitbhu You can fork "robolectric.github.io" repository and use your skills to find the markdown file for building-robolectric section, and then update it and send a PR.

@shashankiitbhu
Copy link

removed the building of native library to AOSP parts

can you please give more context on this or resources? So that I can understand it better and update the required markdown file with correct information

@utzcoz
Copy link
Member

utzcoz commented Mar 4, 2024

@shashankiitbhu I think #8876 (comment) shows you the repository(https://github.com/robolectric/robolectric.github.io) and the file name that you need to modify. And the left things are that you need to learn. I have added essential documentation in robolectric.github.io to build and check changes of the website locally.

@shashankiitbhu
Copy link

shashankiitbhu commented Mar 12, 2024

Hello @utzcoz @hoisie I added the PR for this issue discussed here robolectric/robolectric.github.io#201

Please Review

@shashankiitbhu
Copy link

@hoisie @utzcoz Made appropriate changes and resolved merge conflicts , please review, thanks

@CODE-RED-101
Copy link

I want work on this issues.please assing me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted starter issue Small/simple issues for new contributors
Projects
None yet
Development

No branches or pull requests

4 participants