-
Notifications
You must be signed in to change notification settings - Fork 1
feat(report): enhanced error reporting with troubleshooting hints #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4121bc6
feat(report): add structured troubleshooting hints and scenario metadata
ian-flores b9aee10
fix: guard against missing stash on report.item in pytest_runtest_log…
ian-flores 665962f
fix: address Copilot review feedback
ian-flores 3015689
Merge remote-tracking branch 'origin/main' into enhanced-error-reporting
ian-flores File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| """Tests for vip.gherkin module.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from vip.gherkin import parse_feature_file | ||
|
|
||
|
|
||
| class TestParseFeatureFile: | ||
| def test_basic_feature(self, tmp_path): | ||
| f = tmp_path / "test_basic.feature" | ||
| f.write_text( | ||
| "@connect\n" | ||
| "Feature: Connect authentication\n" | ||
| " As a Posit Team administrator\n" | ||
| " I want to verify Connect auth\n" | ||
| "\n" | ||
| " Scenario: User can log in\n" | ||
| " Given Connect is accessible\n" | ||
| " When a user enters credentials\n" | ||
| " Then the user is authenticated\n" | ||
| ) | ||
| result = parse_feature_file(f) | ||
| assert result["title"] == "Connect authentication" | ||
| assert result["marker"] == "connect" | ||
| assert "Posit Team administrator" in result["description"] | ||
| assert len(result["scenarios"]) == 1 | ||
| assert result["scenarios"][0]["title"] == "User can log in" | ||
| assert len(result["scenarios"][0]["steps"]) == 3 | ||
|
|
||
| def test_multiple_scenarios(self, tmp_path): | ||
| f = tmp_path / "test_multi.feature" | ||
| f.write_text( | ||
| "@prerequisites\n" | ||
| "Feature: Components are reachable\n" | ||
| "\n" | ||
| " Scenario: Connect is reachable\n" | ||
| " Given Connect is configured\n" | ||
| " When I request the health endpoint\n" | ||
| " Then the server responds OK\n" | ||
| "\n" | ||
| " Scenario: Workbench is reachable\n" | ||
| " Given Workbench is configured\n" | ||
| " When I request the health endpoint\n" | ||
| " Then the server responds OK\n" | ||
| ) | ||
| result = parse_feature_file(f) | ||
| assert len(result["scenarios"]) == 2 | ||
| assert result["scenarios"][0]["title"] == "Connect is reachable" | ||
| assert result["scenarios"][1]["title"] == "Workbench is reachable" | ||
|
|
||
| def test_and_but_steps(self, tmp_path): | ||
| f = tmp_path / "test_steps.feature" | ||
| f.write_text( | ||
| "@connect\n" | ||
| "Feature: Steps test\n" | ||
| "\n" | ||
| " Scenario: Complex steps\n" | ||
| " Given a precondition\n" | ||
| " And another precondition\n" | ||
| " When something happens\n" | ||
| " Then result is expected\n" | ||
| " But not this other thing\n" | ||
| ) | ||
| result = parse_feature_file(f) | ||
| steps = result["scenarios"][0]["steps"] | ||
| assert len(steps) == 5 | ||
| assert steps[1].startswith("And ") | ||
| assert steps[4].startswith("But ") | ||
|
|
||
| def test_relative_to(self, tmp_path): | ||
| subdir = tmp_path / "tests" / "connect" | ||
| subdir.mkdir(parents=True) | ||
| f = subdir / "test_auth.feature" | ||
| f.write_text("@connect\nFeature: Auth\n\n Scenario: Login\n Given ready\n") | ||
| result = parse_feature_file(f, relative_to=tmp_path) | ||
| assert result["file"] == "tests/connect/test_auth.feature" | ||
|
|
||
| def test_no_description(self, tmp_path): | ||
| f = tmp_path / "test_no_desc.feature" | ||
| f.write_text( | ||
| "@security\n" | ||
| "Feature: HTTPS enforcement\n" | ||
| "\n" | ||
| " Scenario: All endpoints use HTTPS\n" | ||
| " Given the server URL\n" | ||
| " Then the scheme is HTTPS\n" | ||
| ) | ||
| result = parse_feature_file(f) | ||
| assert result["title"] == "HTTPS enforcement" | ||
| assert result["description"] == "" | ||
|
|
||
| def test_scenario_outline(self, tmp_path): | ||
| f = tmp_path / "test_outline.feature" | ||
| f.write_text( | ||
| "@connect\n" | ||
| "Feature: Outline test\n" | ||
| "\n" | ||
| " Scenario Outline: Deploy <type> content\n" | ||
| " Given Connect is accessible\n" | ||
| " When I deploy a <type> bundle\n" | ||
| " Then the content is running\n" | ||
| "\n" | ||
| " Examples:\n" | ||
| " | type |\n" | ||
| " | shiny |\n" | ||
| " | rmd |\n" | ||
| ) | ||
| result = parse_feature_file(f) | ||
| assert len(result["scenarios"]) == 1 | ||
| assert result["scenarios"][0]["title"] == "Deploy <type> content" | ||
| assert len(result["scenarios"][0]["steps"]) == 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block sets
#| output: falsebut then callsdisplay(...)to announce thatfailures.jsonwas written; with Quarto/Jupyter this output is typically suppressed, so the message won’t render. If you want users to see the note, dropoutput: false(keepecho: false), or remove thedisplay(...)call if the block is meant to be silent.