You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 12, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+29-2
Original file line number
Diff line number
Diff line change
@@ -118,10 +118,10 @@ To add a fixture all you have to do is call one of the `addFixture` methods in t
118
118
serverRule.addFixture(200, "body.json");
119
119
```
120
120
121
-
This will add a response with status code 200 and the contents of the file `body.json` as the body. This file, by default, must be located in a folder with name `fixtures`. This folder works different for Local Tests and Instrumented Tests.
121
+
This will add a response with status code 200 and the contents of the file `body.json` as the body. This file, by default, must be located in a folder with name `fixtures`. This folder works differently for Local Tests and Instrumented Tests.
122
122
123
123
- Local tests: these are run locally in the JVM (usually with Robolectric) and follow different conventions. Your source folder `test` may contain a folder `java` and a folder `resources`. When you compile your code it takes everything in the `resources` folder and puts in the root of your `.class` files. So, your fixtures folder must go inside `resources` folder.
124
-
- Instrumented tests: there are run in a device or emulator (usually with Espresso or Robotium). It follows the android folder layout and so you may have an assets folder inside your `androidTest` folder. Your `fixtures` folder must go there.
124
+
- Instrumented tests: these are run on a device or emulator (usually with Espresso or Robotium). It follows the android folder layout and so you may have an assets folder inside your `androidTest` folder. Your `fixtures` folder must go there.
125
125
126
126
Because of these differences, there are two implementations of `RequestMatcherRule`: `LocalTestRequestMatcherRule` and `InstrumentedTestRequestMatcherRule`. You should use the generic type for your variable and instantiate it with the required type. Example:
127
127
@@ -141,6 +141,33 @@ The difference is that when we run an InstrumentedTest, we must pass the instrum
141
141
142
142
More on the difference between each kind of test [here](https://medium.com/concrete-solutions/android-local-or-instrumented-tests-9da545af7777#.mmowgemc4)
143
143
144
+
#### Fixture templating
145
+
146
+
You can also provide templates for cases when you need dynamic values to be passed to the JSON. For
147
+
this to work you need to provide a JSON file with keys that will be replaced by their values in runtime.
0 commit comments