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.