AI-assisted testing

Advanced AI-Assisted Coding for Developers

Thalia Barrera

AI Engineering Curriculum Manager, DataCamp

Continuing with Atlas

A software developer reviewing code with security shield

 

  • Integrating Atlas into Wayfarer Labs
  • ✅ Must ensure code is tested, secure and resilient
  • 🤖 AI accelerates evaluation and testing of unfamiliar code
Advanced AI-Assisted Coding for Developers

Why AI-assisted testing?

 

  • Uncover untested paths
  • Find edge cases
  • Detect potential vulnerabilities

 

🤖 Start by asking AI to assess testing maturity of the codebase

A magnifying glass examining code with bug icons

Advanced AI-Assisted Coding for Developers

Assessing testing maturity

You are a senior QA engineer and software architect.

Assess how well tested this codebase is and identify the highest-risk gaps. Score the following on a 0-5 scale:

  • Coverage of critical paths
  • Edge-case handling
  • Regression protection
  • CI/CD automation

In addition, identify the test types currently present: unit, integration, end-to-end, regression, property or fuzz tests.

Advanced AI-Assisted Coding for Developers

Testing maturity results

coverage-scores2.png

Advanced AI-Assisted Coding for Developers

Establishing a baseline

coverage-commands2.png

Advanced AI-Assisted Coding for Developers

Analyzing coverage results

coverage-profile2.png

Advanced AI-Assisted Coding for Developers

Testing strategies

 

Testing strategies diagram

 

  • Exploratory → understand behavior
  • Functional → verify outputs
  • Regression → protect existing behavior
  • Automated → fast, repeatable feedback
Advanced AI-Assisted Coding for Developers

Building a test suite

 

What is a test suite?

👉 A structured collection of tests, data, tools, and rules that ensure system behavior remains consistent over time.

🤖 Test suite prompt:

You are a senior software engineer. Generate unit and integration tests for the critical paths in this codebase. Include:

  • Normal cases
  • Edge cases
  • Failure scenarios
  • Clear assertions and fixtures

Also provide a list of all generated tests and a one-sentence description of each.

Advanced AI-Assisted Coding for Developers

Verifying coverage improvement

List of AI-generated tests:

ai-generated-tests2.png

New code coverage:

new-coverage2.png

Advanced AI-Assisted Coding for Developers

Runtime protections

 

Injecting custom data as input ➡ Atlas ❗

🤖 Runtime protection prompt:

When injecting or handling custom data, add runtime protections:

  • Validate inputs before processing (types, required fields, unexpected values)
  • Check schemas at every pipeline boundary, never assume upstream data is clean
  • Return clear error messages that identify what failed and where
  • Apply safe defaults for optional fields rather than leaving them undefined
Advanced AI-Assisted Coding for Developers

CI automation

ci-coverage.png

Advanced AI-Assisted Coding for Developers

Let's practice!

Advanced AI-Assisted Coding for Developers

Preparing Video For Download...