Crates.io | apicize_lib |
lib.rs | apicize_lib |
version | 0.14.1 |
source | src |
created_at | 2024-10-27 21:59:26.039933 |
updated_at | 2024-11-27 05:22:23.452589 |
description | Library supporting Apicize request dispatch, testing and serialization |
homepage | |
repository | https://github.com/apicize/lib-rust |
max_upload_size | |
id | 1425064 |
size | 536,953 |
This is a Rust library supporting Apicize serilization, request dispatching (via Reqwest) and test running (via V8).
Broadly speaking, Workbooks and associated structures are how Apicize testing information is persisted in JSON format.
Workspaces contain indexed views of Workbook structures like requests, scenarios, etc. which make it more efficient
to traverse hierarchical and ordered information.
The function Workspace::open_from_file
will populate a workspace from a a workbook file, its private parameters file, and global
parameters file (if specified). Entities are indexed and warnings are generated if a workbook contains any references to parameters
that are not found in the private or globals file.
The function Workspace::save
persists workspace information to workbook, private parameters and global parameters files. Private parameters
are saved to a file with the same name as the workbook but with an .apicize-priv
extension. Global parameters are saved to the
user's OS configuration directory under apicize/globals.json
.
Tests are executed via the test_runner::run
function, which accepts an Arc to the workspace being tested, an optional list of request IDs to execute (defaults to all), an optional
cancellation token, and an Arc to instant that testing was started.
This library leverages V8 to execute tests to validate requests. This sandboxed envioronment does not include NodeJS or Browser functionality, primarily to prevent arbitrary test code in a Workbook from doing anything harmful.
The following variables and functions are available in the testing sandbox:
The build.rs file triggers a copy of the file test-framework/dist/framework.min.js
file, which is used in the test runner.
If you change test-framework/index.js
or dependencies, you will need to rebuild framework.min.js
To do, run yarn build
from the test-framework
directory.