"Shadowing" : the QA or the client can play themselves their scenarii. The developer can also record the API's endpoints (to build smoke tests)
Keploy captures networking traffic of the output calls towards external tools like Postgres, MySQL, Redis, Elastic-search etc
Keploy uses YAML encoding to check and read records
⚠️ Please note that Keploy v2 is currently in development, with the best experience on Linux. Docker support is experimental and may have some limitations for certain use cases.
Php is not supported for this feature
curl --silent -O -L https://keploy.io/install.sh && source install.sh
1. # make start
2. # keploy record
3. We play our scenario in our app
Rename the generated tests directory (001-homepage)
Many tests files with captures of the Request / Response
`mock.yaml` : record of external calls made during our tests, associated to Request / Response
# make stop
# keploy test
"Denoise": Keploy term to ignore variable content
Request use all of their Header, and "denoise" is applied only during testing, for the DIFFS
Denoise configuration
Publish new line of codes more frequently, with confidence
(non -regression tests)
Changes verified (in CI) before being merged.
Ease the edition tracking : are these changes useful ?
Documentation that shows how an application works.
Nelmio
Keploy
https://github.com/chadyred/keploy-php-symfony
Test 1: API Read - Simple Write
Test 2: HTML Login - Logout
Test 3: Book Creation Form
Test 4: Book Creation via SPA through API platform
To validate a Request/Response test:
Stateless CSRF: validate a test without a "variable" (HASH) token in the Request.
Statelass session: validate access from a Request keploy screenshot (aka record), using a known Token (aka "Authentication: Bearer TOKEN").
Stateless API (Platform): No sessions, use of token.
Assets without HASH / non-versioned: Possible but with consequences on browser cache.
api_platform:
# ..
defaults:
stateless: trueframework:
csrf_protection:
stateless_token_ids:
- authenticate
- book-item
firewalls:
main:
provider: app_user_provider
lazy: true
stateless: true
custom_authenticators:
- App\Authenticator\SimpleStatelessAuthenticatorRegression quickly visible
Re-record if new elements are added to the page: requests are replayed automatically on the application to create new Test & Mock snapshots.
Tests are easy to perform: simply follow a post-feature / post-fix scenario.
Test our endpoints as a developer by using a tool such as ApiPlatform Admin, without writing code, and demonstrate that it works (Smoke test)
OpenAPI format + Keploy = <3 can generate tests, which automatically track API changes without manual recording (Enterprise version, paid)
Testing only the API and its endpoints means we don't test the functionality (integration tests), hence the importance of automating it, just like using OpenAPI format (Enterprise version).
Docker in Docker - DIND
command: "php -S 0.0.0.0:8000 -t public public/index.php -c docker/php/php.ini"
Keploy is based on compiled binaries, executed directly, without a reverse proxy to manage Request / Response.
It listens only to a single Docker container, PHP must act "as a binary"
{"/assets/packages/admin/app.js": "/assets/packages/admin/app-6l1pzHh.js"}
<script src="/build/runtime.5aacd888.js" defer></script>
<script src="/build/app.2eaee54d.js" defer></script>
.cleanupOutputBeforeBuild()
.enableVersioning(false)
AssetMapper
Webpack Encore
<script src="/build/runtime.js" defer></script> <script src="/build/app.js" defer></script>
...`encore dev` ? `encore prod` ? No one !
http://localhost:8000/api/docs.jsonopenapi
# keploy-cloud generate-tests -c "path"
POST
PUT
GET
DELETE
PATCH
Generate tests + mocks from our JSON Schema, with Keploy CLOUD
And why not...Make Symfony the first PHP tool compatible with Keploy #bundle ?
With an open-minded community easy to connect to with via Slack, we can quickly contribute in Go Lang.