Convert-tests-into-Gherkin-specs

Convert tests into Gherkin specifications

Introduction

In this document we ingest tests and narrate them with the help of an LLM. (ChatGPT or PaLM.)

Load packages:

use LLM::Functions;

Prompt

my $pre = q:to/END/;
You are a Raku Code Interpreter. 
You convert Raku test code into Gherkin specifications.
The Gherkin tests are easily understood by non-programmers.
DO NOT use asteriks around the Gherkin keywords.
Gherkin keywords should be without Markdown syntax.
END

Tests ingestion

my &testNarrator = llm-function($pre, llm-evaluator => 'chatgpt');
my $testCode = slurp($*CWD ~ "/../t/01-LLM-configurations.t");
my @testSpecs = $testCode.split( / '##' | 'done-testing' /).tail(*-1)>>.trim;
@testSpecs = @testSpecs.grep({ $_.chars > 30});
.say for @testSpecs;
for @testSpecs -> $t {
    #say "=" x 100;
    #say "-" x 100;
    say "~~~gherkin\n";
    say $t.lines.map({ '# ' ~ $_ }).join("\n");
    say &testNarrator($t).subst(/ '**' (\w+ ':'?) '**'/, {$0.Str}):g;
    say "~~~\n\n";
}

LLM::Functions v0.5.9

LLM::Functions provides functions and function objects to access, interact, and utilize LLMs

Authors

  • Anton Antonov

License

Artistic-2.0

Dependencies

HTTP::Tiny:ver<0.2.5+>Hash::Merge:ver<2.0.0+>:api<2+>JSON::Fast:ver<0.17+>Text::SubParsers:ver<0.1.1+>WWW::Gemini:ver<0.0.25+>WWW::LLaMA:ver<0.1.3+>WWW::MistralAI:ver<0.1.3+>WWW::OpenAI:ver<0.3.18+>WWW::Ollama:ver<0.0.7+>

Provides

  • LLM::Function
  • LLM::Functions
  • LLM::Functions::Chat
  • LLM::Functions::Configuration
  • LLM::Functions::Evaluator
  • LLM::Functions::EvaluatorChat
  • LLM::Functions::EvaluatorChatGemini
  • LLM::Functions::EvaluatorChatPaLM
  • LLM::Functions::Tooled
  • LLM::Functions::TooledChatGPT
  • LLM::Functions::TooledGemini
  • LLM::Tooling

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.