()
| 21 | |
| 22 | |
| 23 | def test_parser(): |
| 24 | test_dir = Path(__file__).parent |
| 25 | feature_file = test_dir / "test.feature" |
| 26 | feature_file_path = str(feature_file.resolve()) |
| 27 | |
| 28 | # Call the function to parse the Gherkin document |
| 29 | gherkin_doc = get_gherkin_document(feature_file_path) |
| 30 | |
| 31 | # Define the expected structure |
| 32 | expected_document = GherkinDocument( |
| 33 | feature=Feature( |
| 34 | keyword="Feature", |
| 35 | location=Location(column=1, line=2), |
| 36 | tags=[], |
| 37 | name="User login", |
| 38 | description=" As a registered user\n I want to be able to log in\n So that I can access my account", |
| 39 | language="en", |
| 40 | children=[ |
| 41 | Child( |
| 42 | background=Background( |
| 43 | id="1", |
| 44 | keyword="Background", |
| 45 | location=Location(column=3, line=8), |
| 46 | name="", |
| 47 | description="", |
| 48 | steps=[ |
| 49 | Step( |
| 50 | id="0", |
| 51 | keyword="Given", |
| 52 | keyword_type="Context", |
| 53 | location=Location(column=5, line=10), |
| 54 | text="the login page is open", |
| 55 | datatable=None, |
| 56 | docstring=None, |
| 57 | ) |
| 58 | ], |
| 59 | ), |
| 60 | rule=None, |
| 61 | scenario=None, |
| 62 | ), |
| 63 | Child( |
| 64 | background=None, |
| 65 | rule=None, |
| 66 | scenario=Scenario( |
| 67 | id="6", |
| 68 | keyword="Scenario", |
| 69 | location=Location(column=3, line=13), |
| 70 | name="Successful login with valid credentials", |
| 71 | description="", |
| 72 | steps=[ |
| 73 | Step( |
| 74 | id="2", |
| 75 | keyword="Given", |
| 76 | keyword_type="Context", |
| 77 | location=Location(column=5, line=14), |
| 78 | text="the user enters a valid username", |
| 79 | datatable=None, |
| 80 | docstring=None, |
nothing calls this directly
no test coverage detected
searching dependent graphs…