Installation
This guide covers the different ways to install HTTP Mock Lib in your Salesforce org.
Using Salesforce CLI
The recommended way to install HTTP Mock Lib is using the Salesforce CLI.
1. Install as an Unlocked Package
sf package install --package 0HoRG00000000XXXXXXX --target-org your-org-alias --wait 10TIP
Replace your-org-alias with your org alias or username.
2. Deploy Source Code
Clone the repository and deploy directly:
# Clone the repository
git clone https://github.com/beyond-the-cloud-dev/http-mock-lib.git
cd http-mock-lib
# Deploy to your org
sf project deploy start --target-org your-org-aliasManual Installation
Using Workbench
- Download the source code from GitHub
- Navigate to Workbench
- Login to your org
- Go to Migration → Deploy
- Select the
force-appfolder and deploy
Using Setup UI
- Copy the class code from HttpMock.cls
- In your Salesforce org, go to Setup → Apex Classes
- Click New
- Paste the code and click Save
Dependencies
HTTP Mock Lib has zero dependencies. It's a standalone library that works out of the box.
API Version
HTTP Mock Lib requires Salesforce API version 64.0 or higher.
Verification
To verify the installation, create a simple test:
@IsTest
private class HttpMockVerificationTest {
@IsTest
static void verifyInstallation() {
new HttpMock()
.whenGetOn('/test')
.body('{"test": true}')
.statusCodeOk()
.mock();
// If this compiles and runs, installation is successful
Assert.isTrue(true);
}
}Run the test:
sf apex run test --class-names HttpMockVerificationTest --target-org your-org-aliasIf the test passes, HTTP Mock Lib is installed correctly! ✅
Next Steps
Now that you have HTTP Mock Lib installed, check out:
Troubleshooting
API Version Error
Error: Invalid API version specified
Solution: Ensure your org supports API version 64.0 or higher. You can check this in Setup → API.
Deployment Fails
Error: Deployment failed
Solution:
- Verify you have sufficient permissions
- Check that your org is not at maximum capacity for Apex classes
- Review any error messages for specific issues
Need Help?
If you encounter any issues:
- Check GitHub Issues
- Create a new issue if your problem isn't listed
- Contact Beyond the Cloud
