Testing
Package: DecSm.Atom.TestUtils
Atom provides test utilities for verifying your build definitions, targets, and modules in unit/integration tests.
Installation
dotnet add package DecSm.Atom.TestUtils
Usage
DecSm.Atom.TestUtils provides helpers for:
- Creating test build definitions
- Mocking services (file system, process runner, etc.)
- Verifying target execution order
- Testing parameter resolution
- Validating generated workflow models
Testing a Target
Set up a test build with mocked services, execute a target, and assert the results:
// Arrange - create a test host with your build definition
// Act - execute the target
// Assert - verify the expected behaviour
Testing Workflow Generation
Verify that your workflow definitions produce the expected YAML by:
- Instantiating the build definition in a test context.
- Running the workflow resolver.
- Comparing the output model against expected values.
Tips
- Use
System.IO.Abstractions.TestingHelpers(already a dependency) for in-memory file system testing. - Mock
IProcessRunnerto avoid executing real processes in tests. - Use snapshot testing to verify generated YAML doesn't change unexpectedly.