How to access files from assets folder during tests execution?

后端 未结 8 2113
旧时难觅i
旧时难觅i 2021-02-01 20:25

How to access files from assets folder during unit tests execution? My project is build using Gradle, I use Robolectric to run tests. It seems like gradle is being recognizing t

8条回答
  •  故里飘歌
    2021-02-01 21:00

    When Robolectric versions previous to 4.0 we need to take in count that:

    By default, Robolectric will assume that your resources and assets are located in directories named res and assets, respectively. These paths are assumed to be relative to the directory where the manifest is located. You can change these values by adding the resourceDir and assetDir options to the @Config annotation.

    See the official docs

提交回复
热议问题