Bump tzinfo from 1.2.7 to 1.2.10 in /Example/CatbirdX (#59)
Bumps tzinfo from 1.2.7 to 1.2.10.
updated-dependencies:
- dependency-name: tzinfo dependency-type: indirect …
Signed-off-by: dependabot[bot] support@github.com
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Catbird
Features
Installation
To use Catbird in UI-tests you must have Catbird server and Catbird API code which allows you to communicate with the server.
Manual
Download catbird.zip archive from the latest release page.
Using Homebrew:
Run the following command:
Using SPM:
If you have an Xcode project, open it and add Catbird Package using the following URL:
https://github.com/RedMadRobot/catbird.git
Using CocoaPods:
Add
Catbird
to UI tests target.Setup in Xcode project
Schema/Edit scheme...
Pre-Actions
New Run Script action
<YOUR_APP_TARGET>
${PODS_ROOT}/Catbird/start.sh
Post-Actions
New Run Script action
<YOUR_APP_TARGET>
${PODS_ROOT}/Catbird/stop.sh
Usage
Request patterns
You can specify a pattern for catch http requests and make a response with mock data. Pattern matching applied for URL and http headers in the request. See
RequestPattern
struct.Three types of patterns can be used:
equal
- the request value must be exactly the same as the pattern value,wildcard
- the request value match with the wildcard pattern (see below),regexp
- the request value match with the regular expression pattern.Note:
If you want to apply a wildcard pattern for the url query parameters, don’t forget escape
?
symbol after domain or path.Wildcard pattern
“Wildcards” are the patterns you type when you do stuff like
ls *.js
on the command line, or putbuild/*
in a.gitignore
file.In our implementation any wildcard pattern translates to regular expression and applies matching with URL or header string.
The following characters have special magic meaning when used in a pattern:
*
matches 0 or more characters?
matches 1 character[a-z]
matches a range of characters, similar to a RegExp range.{bar,baz}
matches one of the substitution listed in braces. For example patternfoo{bar,baz}
matches stringsfoobar
orfoobaz
You can escape special characters with backslash
\
.Negation in groups is not supported.
Example project
Environment variables
CATBIRD_MOCKS_DIR
— Directory where static mocks are located.CATBIRD_RECORD_MODE
— set this variable to1
so that the application starts recording HTTP responses along the path set inCATBIRD_MOCKS_DIR
. Default0
.CATBIRD_REDIRECT_URL
— set this url to forward direct requests to catbird. By default, nil. If the recording mode is not enabled, then first the responses will be searched in the mocks and only if nothing is found, the request will be forwarded.CATBIRD_PROXY_ENABLED
— set this variable to1
to forward proxy requests to catbird. By default,0
. If the recording mode is not enabled, then first the responses will be searched in the mocks and only if nothing is found, the request will be proxied.Redirect example
Run catbird with
CATBIRD_REDIRECT_URL
.All direct requests will be forwarded to
CATBIRD_REDIRECT_URL
.The response will be returned as to the request https://api.github.com/zen
Proxy example
Run catbird with
CATBIRD_PROXY_ENABLED=1
.By enabling this mode, the catbird will be running as a local http proxy server. You can configure your http client to use this proxy, and all requests will be proxied thought the catbird and redirected to the real host. It might be helpful if you don’t want to change the base url of your requests.
Logs
Logs can be viewed in the
Console.app
with subsystemcom.redmadrobot.catbird
Don’t forget to include the message in the action menu
Without this, only error messages will be visible
Web
You can view a list of all intercepted requests on the page http://127.0.0.1:8080/catbird
Parallel testing
For parallel testing you need to fulfill several conditions.
Catbird
instance for each test case or test method with a uniqueparallelId
identifier.parallelId
to the application.parallelId
as X-Catbird-Parallel-Id to each request header in application.