Testing
Test your BoxLang module with TestBox and integrate testing into your CI/CD pipeline
TestBox Testing
Test Structure
my-module/
├── tests/
│ ├── Application.bx # TestBox test harness
│ ├── specs/
│ │ ├── MyBIFTest.bx # BDD-style tests
│ │ └── MyComponentTest.bx
│ └── resources/
│ └── fixtures/BDD-Style Test Example
describe( "Greet BIF", () => {
beforeEach( () => {
variables.result = greet( "World" )
} )
it( "returns a greeting string", () => {
expect( variables.result ).toBeString()
} )
it( "includes the name in the greeting", () => {
expect( variables.result ).toInclude( "World" )
} )
it( "uses custom greeting when provided", () => {
var custom = greet( name = "World", greeting = "Hi" )
expect( custom ).toInclude( "Hi" )
} )
} )xUnit-Style Test Example
Running Tests
JUnit Testing (Java Modules)
Integration Testing
CI/CD Integration
GitHub Actions Example
Test Best Practices
Next Steps
Last updated
Was this helpful?
