fastn test #1586
amitu
started this conversation in
Ideas & RFCs
fastn test
#1586
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Status: Work In Progress (`--headless`)
_tests
).test.ftd
can contain${foo}
JS string formatting characters.text.ftd
can contain JS string formatting, variable reference etc--live
modeWe want end to end testing for fastn.
_tests
folderWe let people write bunch of tests and store them in
_tests
folder.fastn build
will ignore this folderfastn test
cliThis cli can run in headless mode
fastn test --headless
or in live modefastn test --live
mode. This runs all the test cases in_tests
folder.Test Case
A test case is stored in a file with
.test.ftd
extension. All files with this extension in_tests
folder are considered test cases.fastn.test.data
This is optional data, in JSON form, which is available to
Special variable
fastn.test-data
JS code will have access to
fastn.steps
, which will contain all the steps (include future steps), with data about each test that is already run.step.requests
captures all the requests made by fastn using fastn processor, andqueries
captures sql processor data.observer-data
captures stack trace, with embedded logs and timing for why the request took the time it took.Special variable:
fastn.test-data.next-url
andfastn.test-data.next-post-body
Sometimes the URL we want to visit, or the post data we want to pass can not be hard coded, and has to computed using js. If these two variables are set, and the test step refers to them:
tests/fixtures
This is a special folder, which contains fixtures. Fixture can be included in any test by using the
fixture
key:Cleanup
Browser cookies are purged between each test case run. If you want to cleanup database etc, write a HTTP end point, and access it from your fixture as the first step.
Beta Was this translation helpful? Give feedback.
All reactions