@originator/suitecrm-test-runner
v2.2.0
Published
CLI tool to run verification tests or launch SuiteCRM server with Docker
Maintainers
Readme
SuiteCRM Test Runner
A Node.js CLI tool to run verification tests or launch SuiteCRM server with Docker. Downloads ZIP files containing database dumps and patches, sets up the necessary files, and runs Docker containers with proper configuration.
Installation
npm install -g @originator/suitecrm-test-runnerOr use it locally in your project:
npm install @originator/suitecrm-test-runner
npx suitecrm-test-runner --helpQuick Start
Run Verification Tests
suitecrm-test-runner verify \
-p ./verifier.py \
-u https://example.com/test-data.zipLaunch SuiteCRM Server
suitecrm-test-runner suitecrm \
-u https://example.com/test-data.zipCommands
verify - Run Verification Tests
Runs your Python verifier script against a SuiteCRM database.
Required Options:
-p, --python <path>- Path to Python verifier file-u, --url <url>- URL to zip file containingdb_dump.sqland optionallysuitecrm_diff.patch
Optional Options:
--cleanup- Clean up temporary files after execution
Example:
suitecrm-test-runner verify \
-p ./my-verifier.py \
-u https://example.com/data.zip \
--cleanupsuitecrm - Launch SuiteCRM Server
Starts a SuiteCRM server with your database dump and optional patch applied.
Required Options:
-u, --url <url>- URL to zip file containingdb_dump.sqland optionallysuitecrm_diff.patch
Optional Options:
--cleanup- Clean up temporary files after execution
Example:
suitecrm-test-runner suitecrm \
-u https://example.com/data.zip If you don't specify a port, the tool will automatically:
- Find an available random port
- Launch the SuiteCRM server
- Wait for it to be ready
- Open your default browser to
http://localhost:<port>
ZIP File Structure
The zip file should contain:
db_dump.sql(required) - SQL database dump filesuitecrm_diff.patch(optional) - SuiteCRM patch file
Files can be in any directory within the zip file - the tool will find them recursively.
How It Works
Verify Command
- Creates a temporary workspace
- Downloads the ZIP file from the URL
- Extracts
db_dump.sqland optionalsuitecrm_diff.patch - Copies your Python verifier file
- Runs Docker with volume mounts:
/app/verifier.py- Your verification script/app/db_dump.sql- Database dump/app/suitecrm_diff.patch- Patch file (if present)
- Executes
python3 test.pywith your database credentials - Formats and displays the JSON results (success, score, explanation)
- Cleans up containers and temporary files
SuiteCRM Command
- Creates a temporary workspace
- Downloads the ZIP file from the URL
- Extracts
db_dump.sqland optionalsuitecrm_diff.patch - Finds an available port (or uses the one you specify)
- Runs Docker with:
- Port mapping:
<host-port>:80 - Volume mounts for dump and patch files
- Port mapping:
- Applies the patch to SuiteCRM (if provided)
- Imports the database dump
- Starts Apache web server
- Waits for the server to be ready
- Opens your default browser automatically
- Stops the container when you exit (Ctrl+C)
Requirements
- Node.js 14.0.0 or higher
- Docker installed and running
- Docker image built and available (default:
runner)
Building the Docker Image
Before using this tool, you need to build the Docker image:
cd runner
docker build -t runner .The Docker image should:
- Have SuiteCRM installed at
/apps/suitecrm - Have MySQL server configured
- Include
test.pyandsuitecrm.pyscripts in/app - Use
/start_mysql_and_run.shas the entrypoint
Output Format
Verify Command Output
The verify command displays formatted results:
============================================================
TEST RESULTS
============================================================
Success: ✓ TRUE
Score: 1
Explanation: Task completed successfully: all requirements met.
============================================================SuiteCRM Command Output
The suitecrm command shows:
- Selected port number
- Container launch status
- Server readiness confirmation
- Browser opening notification
Error Handling
- If the ZIP file is missing required files, the tool will error with a clear message
- If Docker is not running, you'll get a helpful error
- If a port is already in use, the tool will select a random available port
- Containers are automatically stopped when you exit the CLI (Ctrl+C)
License
ISC
Author
Originator Inc
