Package Manager
Install SemanticTest using your preferred package manager:
npm install @blade47/semantic-test
Environment Setup
Optional: OpenAI API Key
If you want to use the LLMJudge block for semantic validation, you’ll need an OpenAI API key.
Create .env file
Create a .env file in your project root:OPENAI_API_KEY=sk-proj-your-key-here
Load environment variables
The CLI automatically loads .env files. For programmatic usage:
All other blocks work without any API keys!
Verify Installation
Create a simple test file to verify installation:
{
"name": "Installation Test",
"tests": [{
"id": "verify",
"pipeline": [{
"block": "MockData",
"config": {
"data": { "message": "Hello, SemanticTest!" }
},
"output": "result"
}],
"assertions": {
"result.message": "Hello, SemanticTest!"
}
}]
}
Run it:
You should see:
✅ Installation Test
✅ verify (5ms)
✅ result.message = "Hello, SemanticTest!"
1 test passed, 0 failed
Project Structure
We recommend organizing your tests like this:
your-project/
├── tests/
│ ├── api/
│ │ ├── users.json
│ │ └── auth.json
│ ├── ai/
│ │ ├── chat.json
│ │ └── tools.json
│ └── integration/
│ └── e2e.json
├── .env
└── package.json
Next Steps