Skip to main content
title: ‘Using Experiments in CI/CD and Testing’ description: ‘Learn how to leverage Basalt Experiments for automated testing and quality assurance in AI workflows.’ Experiments in Basalt are not just for comparing different variants of your AI workflows — they also provide powerful capabilities for automated testing, continuous integration/continuous deployment (CI/CD), and quality assurance. This guide explores how to effectively use experiments in your testing and deployment pipelines.

Automating Quality Assurance for AI

Traditional software testing methods don’t always translate well to AI applications. LLMs can produce variable outputs for the same input, making deterministic testing challenging. Basalt Experiments solve this problem by enabling:

Setting Up Experiments for Testing

Basic Test Setup

The fundamental pattern for using experiments in testing is:

Mock Data Testing

For controlled testing environments, you can use mock data to ensure consistent inputs:

Integrating with CI/CD Pipelines

GitHub Actions Example

Here’s how to integrate Basalt Experiments into a GitHub Actions workflow:
Your test script would create an experiment, run the tests, and write the experiment ID to an output file that the post-results script could use.

Regression Testing

Regression testing ensures that improvements or changes to your AI workflows don’t negatively impact performance or quality:

Production Validation

Before deploying new AI workflows to production, you can validate them with experiments:

Best Practices for CI/CD and Testing

1. Experiment Naming Conventions

Establish clear naming conventions for your experiments:
  • Include build numbers or commit hashes in experiment names for traceability
  • Use prefixes like test-, regression-, or validation- to indicate the experiment purpose
  • Add timestamps to make experiments easily identifiable in chronological order

2. Metadata Standardization

Standardize metadata across your traces to enable consistent analysis:
  • Include relevant build information in all traces (e.g., version, environment)
  • Define expected outcomes in metadata for easier comparison

3. Automation Best Practices

  • Create dedicated CI/CD jobs for different types of AI tests (unit, integration, regression)
  • Run critical tests on every PR, but reserve extensive testing for nightly builds
  • Archive experiment IDs in your CI/CD system for future reference
  • Set up automated notifications for test failures or regressions

4. Statistical Considerations

  • Ensure sample sizes are large enough to draw meaningful conclusions
  • Account for LLM variability by using thresholds rather than exact matching
  • Track trends over time rather than focusing on individual test runs
  • Consider statistical significance when comparing experiments