Skip to content

RF-39249 Add AI Test Generation Command#500

Merged
sebaherrera07 merged 3 commits into
masterfrom
RF-39249-support-ai-test-generation
Feb 19, 2026
Merged

RF-39249 Add AI Test Generation Command#500
sebaherrera07 merged 3 commits into
masterfrom
RF-39249-support-ai-test-generation

Conversation

@sebaherrera07

@sebaherrera07 sebaherrera07 commented Feb 3, 2026

Copy link
Copy Markdown

Tested manually ☑️

Introduces AI-powered test generation to the Rainforest CLI, allowing users to create tests using natural language prompts.

New Commands

rainforest generate - Generate a new test from a natural language prompt

rainforest generate "Log in with valid credentials" --title "Log In Flow"  --start-uri /login --platform windows11_chrome

Key Features

  • Natural language prompt input
  • Support for --start-uri or --url (mutually exclusive)
  • Support for --title
  • Optional --environment-id flags
  • Login via --credentials (free-form string passed to AI) or --login-snippet-id (mutually exclusive)
  • Single platform support via --platform (validated with [a-z0-9_] pattern)

Implementation Highlights

  • Added CreateTestWithAI() API method
  • Comprehensive validation (mutual exclusivity, required fields, platform format)
  • Single browser enforcement (API limitation)
  • Backend handles defaults for platform and title when not specified

Version: 3.8.0

@marvin-rfbot

marvin-rfbot Bot commented Feb 3, 2026

Copy link
Copy Markdown

This comment was marked as outdated.

This comment was marked as outdated.

@sebaherrera07 sebaherrera07 changed the title RF-39249 Add generate command for AI test generation [WIP] RF-39249 Add generate command for AI test generation Feb 3, 2026
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch 2 times, most recently from 7119044 to 7fa7b22 Compare February 3, 2026 18:26
@sebaherrera07 sebaherrera07 requested a review from Copilot February 3, 2026 18:26
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch from 7fa7b22 to 4be863d Compare February 3, 2026 18:29

This comment was marked as outdated.

@sebaherrera07 sebaherrera07 changed the title [WIP] RF-39249 Add generate command for AI test generation [WIP] RF-39249 Add AI Test Generation and Regeneration Commands Feb 3, 2026
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch from 4be863d to c179fac Compare February 3, 2026 21:46
@sebaherrera07 sebaherrera07 requested a review from Copilot February 3, 2026 21:48

This comment was marked as outdated.

This comment was marked as outdated.

@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch 2 times, most recently from 22f31f0 to 74bf734 Compare February 4, 2026 17:38
@sebaherrera07 sebaherrera07 changed the title [WIP] RF-39249 Add AI Test Generation and Regeneration Commands [WIP] RF-39249 Add AI Test Generation Command Feb 4, 2026
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch 2 times, most recently from b696760 to 26f2e5f Compare February 4, 2026 18:06
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch 2 times, most recently from ef9679b to efead42 Compare February 10, 2026 18:29
@sebaherrera07 sebaherrera07 changed the title [WIP] RF-39249 Add AI Test Generation Command RF-39249 Add AI Test Generation Command Feb 10, 2026
Comment thread rainforest/tests.go Outdated
Comment thread rainforest/tests.go Outdated
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch from efead42 to 8e41eb9 Compare February 11, 2026 17:52
@sebaherrera07

Copy link
Copy Markdown
Author

/reviewme @ubergeek42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests.go Outdated
Comment thread rainforest-cli.go
Comment thread README.md Outdated

@ubergeek42 ubergeek42 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have a bunch of questions/concerns about RFML/download/export, because I don't think that's a thing for automated tests.

Comment thread README.md Outdated
Comment on lines +218 to +222
Download the generated test as an RFML file after creation.

```bash
rainforest generate "Search for a product" --start-uri /search --download
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this makes any sense. RFML is for plain english tests, which test generation doesn't produce.

Comment thread rainforest-cli.go Outdated
},
cli.StringFlag{
Name: "credentials",
Usage: "Credentials information to pass to the AI for test generation. Mutually exclusive with --login-snippet-id.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This help text seems like it could be better. What is the expected format for this? Is it just an opaque string that gets passed into some AI model under the hood, so you can write whatever you want here? Or do they need to be username: whatever; password: something_else?

Comment thread rainforest-cli.go Outdated
Comment on lines +402 to +405
cli.BoolFlag{
Name: "download, d",
Usage: "Download the generated test as an RFML file after creation.",
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise, I don't think this makes sense.

Comment thread tests.go Outdated
Comment on lines +315 to +316
if len(browserNames) == 0 {
browserName = "windows11_chrome"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the backend require us to pass a value for platform? If we leave it blank/unset/null in the api request, will it default to something sane on the backend?

I'd prefer not to set a default here if the backend will already do so, as it makes changing the default later on more annoying (two places instead of one)

Comment thread tests.go Outdated
// parseAndValidateBrowser parses the platform flag for AI test generation.
// Returns the browsers array with a single browser name.
func parseAndValidateBrowser(c cliContext) ([]string, error) {
browserNames := c.StringSlice("platform")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little curious why we're doing any processing on this to turn it into a list, just to say "hey, we don't support this being a list". Shouldn't it just be that we only accept a single platform, and let the backend validate it as a valid platform or not. And if we want to get fancier, just say that anything that contains characters other than [a-z0-9_] isn't valid.

Comment thread tests.go Outdated

title := c.String("title")
if title == "" {
// Use first 50 characters (runes) of prompt as default title

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope, but I wonder if we should just send in an empty title, and have the backend generate one based on what actually got created. Similar to how chatgpt/gemini/etc give a name to your chat after your initial message that "summarizes" what it's about.

But similar to the above, I don't like setting a default/passing it in if we can avoid it and let the backend choose a sane default. I don't know what the backend behavior currently is, so maybe this is fine for now.

Comment thread tests.go Outdated
Comment on lines +401 to +403
log.Printf("Successfully created test #%d: %s", response.TestID, response.Title)
log.Printf("RFML ID: %s", response.RFMLID)
log.Printf("State: %s", response.State)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this needs some note about how the test is technically created, but is still processing/generating? And RFMLID should go away.

@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch 2 times, most recently from ce865c0 to 8098c2d Compare February 12, 2026 18:47
@sebaherrera07

Copy link
Copy Markdown
Author

/reviewme @ubergeek42

@marvin-rfbot marvin-rfbot Bot requested a review from ubergeek42 February 12, 2026 18:55
Comment thread rainforest/tests.go Outdated
Sebastian Herrera added 2 commits February 19, 2026 13:05
Add support for generating tests using AI through the CLI. The new
`generate` command (with `gen` and `ai` aliases) accepts a natural
language prompt and creates a test via the Rainforest API.

Features:
- Generate tests from natural language prompts
- Support for --start-uri or --url to specify the starting point
- Optional --title flag for custom test name
- Optional --environment-id flag for test environment
- Support for authentication via --credentials or --login-snippet-id
  (mutually exclusive); credentials is a free-form string passed to
  the AI model
- Platform selection with --platform (single value, validated with
  [a-z0-9_] pattern, backend provides default if omitted)
- Comprehensive validation and error handling

Example usage:
  rainforest generate "Log in with valid credentials" --start-uri /login
  rainforest generate "Add item to cart" --url https://example.com
Update version constant and add CHANGELOG entry for the new
`generate` command feature.
@sebaherrera07 sebaherrera07 force-pushed the RF-39249-support-ai-test-generation branch from 8098c2d to 77c5790 Compare February 19, 2026 16:06
@sebaherrera07 sebaherrera07 merged commit 2b12c5f into master Feb 19, 2026
20 checks passed
@sebaherrera07 sebaherrera07 deleted the RF-39249-support-ai-test-generation branch February 19, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants