npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ai-ctrf

v0.0.5

Published

AI Test Reporter - Create human-readable summaries of test results with LLMs like OpenAI GPT

Downloads

565

Readme

AI Test Reporter

Generate AI test summaries using leading AI models from OpenAI and Anthropic Claude. Integrate with Developer tooling to provide AI summaries where you need them.

⭐⭐ If you find this project useful, consider giving it a GitHub star ⭐⭐

You can help us grow

Support our mission to enhance test reporting with AI summaries by:

  • ⭐ Starring this repository to show your support. ⭐
  • 🙌 Following our GitHub page here 🙌

Thank you! Your support is invaluable to us! 💙

Key Features

  • Generate human-readable AI summaries for failed tests
  • Use your own AI model, with support for OpenAI, Anthropic Claude and more soon
  • Compatible with all major testing frameworks through standardized CTRF reports.
  • Integrates AI with various CI/CD and developer tools.
  • Customizable parameters like system prompt, model, temperature, max tokens, and more.
  • Log AI generated summaries to the console.

stdout

Usage

Generate a CTRF report using your testing framework. CTRF reporters are available for most testing frameworks and easy to install.

No CTRF reporter? No problem!

Use junit-to-ctrf to convert a JUnit report to CTRF

OpenAI

Run the following command:

npx ai-ctrf openai <path-to-ctrf-report>

An AI summary for each failed test will be added to your test report.

The package interacts with the OpenAI API, you must set OPENAI_API_KEY environment variable.

You will be responsible for any charges incurred from using your selected OpenAI model. Make sure you are aware of the associated cost.

A message is sent to OpenAI for each failed test.

Options

--model: OpenAI model to use (default: gpt-3.5-turbo).

--systemPrompt: Custom system prompt to guide the AI response.

--frequencyPenalty: OpenAI frequency penalty parameter (default: 0).

--maxTokens: Maximum number of tokens for the response.

--presencePenalty: OpenAI presence penalty parameter (default: 0).

--temperature: Sampling temperature (conflicts with topP).

--topP: Top-p sampling parameter (conflicts with temperature).

--log: Whether to log the AI responses to the console (default: true).

--maxMessages: Limit the number of failing tests to send for summarization in the LLM request. This helps avoid overwhelming the model when dealing with reports that have many failing tests. (default: 10)

consolidate: Consolidate and summarize multiple AI summaries into a higher-level overview (default: true)

Azure OpenAI

Run the following command:

npx ai-ctrf azure-openai <path-to-ctrf-report>

An AI summary for each failed test will be added to your test report.

The package interacts with the Azure OpenAI API, you must set AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, and AZURE_OPENAI_DEPLOYMENT_NAME environment variable or provide them as arguments.

You will be responsible for any charges incurred from using your selected Azure OpenAI model. Make sure you are aware of the associated cost.

A message is sent to Azure OpenAI for each failed test.

Options

--model: OpenAI model to use (default: gpt-3.5-turbo).

--systemPrompt: Custom system prompt to guide the AI response.

--frequencyPenalty: OpenAI frequency penalty parameter (default: 0).

--maxTokens: Maximum number of tokens for the response.

--presencePenalty: OpenAI presence penalty parameter (default: 0).

--temperature: Sampling temperature (conflicts with topP).

--topP: Top-p sampling parameter (conflicts with temperature).

--log: Whether to log the AI responses to the console (default: true).

--maxMessages: Limit the number of failing tests to send for summarization in the LLM request. This helps avoid overwhelming the model when dealing with reports that have many failing tests. (default: 10)

consolidate: Consolidate and summarize multiple AI summaries into a higher-level overview (default: true)

Claude

Run the following command:

npx ai-ctrf claude <path-to-ctrf-report>

An AI summary for each failed test will be added to your test report.

The package interacts with the Anthropic API, you must set ANTHROPIC_API_KEY environment variable.

You will be responsible for any charges incurred from using your selected Claude model. Make sure you are aware of the associated costs.

A message is sent to Claude for each failed test.

Claude Options

--model: Claude model to use (default: claude-3-5-sonnet-20240620).

--systemPrompt: Custom system prompt to guide the AI response.

--maxTokens: Maximum number of tokens for the response.

--temperature: Sampling temperature.

--log: Whether to log the AI responses to the console (default: true).

--maxMessages: Limit the number of failing tests to send for summarization in the LLM request. This helps avoid overwhelming the model when dealing with reports that have many failing tests. (default: 10)

consolidate: Consolidate and summarize multiple AI summaries into a higher-level overview (default: true)

CTRF Report Example

{
  "results": {
    "tool": {
      "name": "AnyFramework"
    },
    "summary": {
      "tests": 1,
      "passed": 0,
      "failed": 1,
      "pending": 0,
      "skipped": 0,
      "other": 1,
      "start": 1722511783500,
      "stop": 1722511804528
    },
    "tests": [
        {
            "name": "should display profile information",
            "status": "failed",
            "duration": 800,
            "message": "Assertion Failure: profile mismatch",
            "trace": "ProfileTest.js:45...",
            "ai": "The test failed because there was a profile mismatch at line 45 of the ProfileTest.js file. To resolve this issue,   review the code at line 45 to ensure that the expected profile information matches the actual data being displayed. Check for any discrepancies and make necessary adjustments to align the expected and actual profile information."
        },
    ]
  }
}

Standard Output

stdout

GitHub Actions Integration

View AI summaries in directly in the Github Actions workflow:

Github

Add a Pull Request comment with your AI summary:

Github

Slack Integration

Send a Slack message with your AI test summary:

Slack

Support Us

If you find this project useful, consider giving it a GitHub star ⭐ It means a lot to us.