简体   繁体   中英

How does Robolectric work? Why does my unit test download some jars while first run Unit Test?

I am going to run a Unit Test in Android Studio, to test my method in ViewModel, I use Robolectric to do this.

Everything works correctly. I found when i run test first time, it downloads some jars automaticly. like org.robolectric:android-all:jar:5.0.0_r2-robolectric-1 .

So can anybody tell me how does Robolectric download jars, By gradle? or something else? And why does it need these jars?

It is not gradle . I think it is just junit test runner.

Robolectric loads Android dependency on the first run. And it downloads it from maven repository.

Robolectric downloads compiled sources of AOSP project to avoid mocking/faking entire Android system

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM