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 Jan 5, 2023. It is now read-only.
Copy file name to clipboardexpand all lines: README.md
+55
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,19 @@
6
6
7
7
Bokor is a simple, Record and Playback Mock Server written in Node.js, utilized for Service Virtualization.
8
8
9
+
Bokor is very similar to the many VCR-like tools out there today, but prides itself on its ease of use and speed to setup. It can be utilized for any mocking needs, but was primarily developed for mocking back end service calls in automated UI testing.
10
+
11
+
Bokor was developed and is in use at Nike since early 2016. There, it is used to improve the speed, reliability and test coverage of the integration and user interface test suites for native mobile applications.
-[Relative Date Time Objects](#relative-date-time-objects)
19
+
-[Static Resources](#static-resources)
20
+
-[Admin Server](#admin-server)
21
+
-[Port](#port)
14
22
-[Data Fixtures](#data-fixtures)
15
23
-[Data Bins](#data-bins)
16
24
-[Fixture Filenames](#fixture-filenames)
@@ -125,6 +133,43 @@ bokor server rolled lucky 7777
125
133
126
134
### Advanced Configuration
127
135
136
+
#### Relative Date Time Objects
137
+
Often we find the need to have date time results relative from the current date time. For example; "5 minutes from now" or "Exactly 3 days from now". With Bokor you can manipulate your recorded date time values in any possible way you can imagine.
138
+
139
+
##### Create `datetimes.properties` file
140
+
First create a key name that is meaningful like: `NOW_DATETIME_UTC`. Next utilizing the [Moment.JS library](http://momentjs.com/) create your javascript function that will manipulate the date time to your needs like: `moment().utc().format()`, making sure to escape any single quotes.
141
+
142
+
```javascript
143
+
var datetimes = {
144
+
datetime1: {
145
+
key:'NOW_DATETIME_UTC',
146
+
value:'moment().utc().format()',
147
+
},
148
+
datetime2: {
149
+
key:'NOW_DATETIME_UTC_PLUS_10_MINUTES',
150
+
value:'moment().utc().add(10, \'m\').format()',
151
+
}
152
+
};
153
+
module.exports= datetimes;
154
+
```
155
+
156
+
##### Add the date time configuration to the `server.js` file.
157
+
```javascript
158
+
var serversProperties =require('./servers.properties');
159
+
var filtersProperties =require('./filters.properties');
160
+
var datetimesProperties =require('./datetimes.properties');
161
+
162
+
var bokor =require('bokor');
163
+
164
+
bokor.start({
165
+
servers : serversProperties,
166
+
filters : filtersProperties,
167
+
datetimes : datetimesProperties
168
+
});
169
+
```
170
+
Once you have completed the configuration modify your recorded data fixtures, by replacing date time values with a the key values you created. Bokor will dynamically create date time values the next time you request that data fixture.
171
+
172
+
128
173
#### Static Resources
129
174
By default Bokor serves any static resource in the `static_files` folder. You can modify this folder name by adjusting the server config.
Copy file name to clipboardexpand all lines: lib/sepia/README.md
+10-1
Original file line number
Diff line number
Diff line change
@@ -261,6 +261,16 @@ Examples of this functionality can be seen in `examples/headers.js`:
261
261
rm -r fixtures # in case you had previously generated fixtures
262
262
VCR_MODE=cache node examples/headers
263
263
264
+
## Hiding Sensitive Data
265
+
266
+
It is good practice to avoid checking sensitive data into source control. Sepia
267
+
can substituting specific text in headers and bodies with values you specify. The substitute function takes a substitution string as a first argument and a function which
268
+
returns the actual value, presumably retrieved from the environment. Your fixtures
269
+
will contain the substitution string, and can be safely committed to source control.
0 commit comments