Mock Registryโ
Mock Registry uploads mock files to cloud storage, keeping the application's repository lightweight and manageable.
When dealing with large mock files during tests, committing them to git repositories can be cumbersome. Uploading such mocks to cloud storage instead helps maintain a clean and performant repository, reducing complexity.
Usage ๐ ๏ธโ
Disabling Mock Uploadโ
Mock are uploaded to cloud by default
and can be disabled using CLI or keploy config.
Disable using CLI flagโ
To disable mock uploads for a specific test run, use the --disableMockUpload=true flag:
keploy test -c "<appCmd>" --disableMockUpload=true
Disable using keploy config fileโ
Set the mock upload preference in the configuration file to enable or disable mock uploads by default for all test runs:
# keploy.yaml
disableMockUpload: true
Mock Registry Behaviorโ
Test Run Passed โ โ
If test cases pass, mocks are uploaded to the cloud, added to .gitignore, and a config.yml is generated with a unique Mock ID.
TestRun Failed โโ
If one or more test cases are failed, Mocks would not be uploaded to cloud and config.yml
is not generated, but mocks would still be moved to .gitignore
.
Local Mock is missing ๐ซโ
If mocks are missing locally, they will be downloaded from the cloud during the test run.
Different Mocks Locally and Cloud ๐โ
If mocks present locally and in the cloud are different, mocks from the cloud will be downloaded and used during the test run.
Upload Updated Mocks ๐คโ
To update mocks in the cloud, delete the config.yml
under the test set folder. When tests are run, a new config file will be generated, and updated mocks will be uploaded to the cloud.
If using --removeUnuseMocks
๐งนโ
When --removeUnusedMocks
is used, config.yml
will be updated with a new Mock ID, and those mocks will be treated as new mocks.
Public and Private Mocks ๐โ
Mocks can be classified as public or private based on their usage and accessibility:
Public Mocks ๐โ
Public mocks are accessible by all users and can be shared across multiple projects. Use public mocks when the data is generic and not sensitive.
Private Mocks ๐โ
Private mocks are restricted to specific users or projects. Use private mocks for sensitive or project-specific data to ensure security and privacy.