Skip to content

Commit

Permalink
feat(GherkinParser): first running version
Browse files Browse the repository at this point in the history
  • Loading branch information
d-biehl committed Feb 3, 2024
1 parent 9e9d47e commit bef0e6f
Show file tree
Hide file tree
Showing 24 changed files with 1,055 additions and 18 deletions.
1 change: 1 addition & 0 deletions examples/simple/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
results/
42 changes: 42 additions & 0 deletions examples/simple/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "RobotCode: Run Current",
"type": "robotcode",
"request": "launch",
"cwd": "${workspaceFolder}",
"target": "${file}"
},
{
"name": "RobotCode: Run All",
"type": "robotcode",
"request": "launch",
"cwd": "${workspaceFolder}",
"target": "."
},
{
"name": "RobotCode: Default",
"type": "robotcode",
"request": "launch",
"purpose": "default",
"presentation": {
"hidden": true
},
"attachPython": true,
"pythonConfiguration": "RobotCode: Python"
},
{
"name": "RobotCode: Python",
"type": "python",
"request": "attach",
"presentation": {
"hidden": true
},
"justMyCode": false
}
]
}
8 changes: 8 additions & 0 deletions examples/simple/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// "robotcode.extraArgs": [
// "-v"
// ]
"robotcode.debug.attachPython": true,
"debugpy.debugJustMyCode": false,
"python.analysis.typeCheckingMode": "off"
}
30 changes: 30 additions & 0 deletions examples/simple/features/Minimal.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@browser
Feature: Minimal

@minimal
Scenario: minimalistic
Given the minimalism

@maximal
Scenario: another one
Given do something in the maximal way

@another
@slow
Scenario: another one1
Given the minimalism

@browser
Scenario: the last one
Given the minimalism

Scenario Outline: Cucumber Data Table
Given Table with example
| FirstName | <FirstName> |
| MiddleName | <MiddleName> |
| LastName | <LastName> |

Examples:
| FirstName | MiddleName | LastName |
| Daniel | D | Biehl |
| Philip | K | Dick |
7 changes: 7 additions & 0 deletions examples/simple/features/__init__.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*** Settings ***
Suite Setup Log Suite Setup
Suite Teardown Log Suite Teardown
Test Setup Log Test Setup
Test Teardown Log Test Teardown

Resource ./steps/hooks.resource
18 changes: 18 additions & 0 deletions examples/simple/features/rule_sample.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Highlander

Rule: There can be only One

Example: Only One -- More than one alive
Given there are 3 ninjas
And there are more than one ninja alive
When 2 ninjas meet, they will fight
Then one ninja dies (but not me)
And there is one ninja less alive

Example: Only One -- One alive
Given there is only 1 ninja alive
Then he (or she) will live forever ;-)

Rule: There can be Two (in some cases)

Example: Two -- Dead and Reborn as Phoenix
7 changes: 7 additions & 0 deletions examples/simple/features/simple.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Feature: blah

@atag
## Scenario: whatever

- Given something
- When something else
2 changes: 2 additions & 0 deletions examples/simple/features/steps/__init__.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*** Settings ***
Library step_impls.py
35 changes: 35 additions & 0 deletions examples/simple/features/steps/hooks.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*** Keywords ***
before_test
[Arguments] ${context}= ${test}=
[Tags] hook:before-test
Log before test
Fail har har test

before_suite
[Arguments] ${context}= ${suite}=
[Tags] hook:before-suite
Log hook before suite
#Fail hahar suite

before_keyword
[Arguments] ${context}= ${suite}=
[Tags] hook:before-keyword
Log before keyword
Fail blah
RETURN after_keyword

after_keyword
[Arguments] ${context}= ${suite}=
[Tags] hook:after-step
Log after step

before_tag
[Arguments] ${context}= ${suite}=
[Tags] hook:before-tag
Log before suite


start_browser
[Arguments] ${context}= ${suite}=
[Tags] hook:before-tag:browser
Log before suite
11 changes: 11 additions & 0 deletions examples/simple/features/steps/simple.resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*** Settings ***
Library step_impls.py

*** Keywords ***
the minimalism
Log yeah

Table with example
[Arguments] ${blah}

log ${blah}
14 changes: 14 additions & 0 deletions examples/simple/features/steps/step_impls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Optional

from robot.api.deco import keyword


@keyword(name="before_feature", tags=["hook:before-feature"])
def before_feature(lang: Optional[str] = None):
print("I'm doing something in lang")
#raise Exception("I'm failing")


@keyword(name="Do something in ${lang}")
def do_something_in_python(lang: str):
print(f"I'm doing something in {lang}")
2 changes: 2 additions & 0 deletions examples/simple/robot.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[parsers]
GherkinParser = []
9 changes: 9 additions & 0 deletions examples/simple/tests/first.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*** Test Cases ***
first
Run Keyword My Keyword


*** Keywords ***
My Keyword
# TODO: implement keyword "My Keyword".
Fail Not Implemented
20 changes: 7 additions & 13 deletions hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,23 @@ extra-dependencies = [
python = "3.8"

[[envs.devel.matrix]]
python = ["3.8", "3.9", "3.10", "3.11"]
rf = ["rf61b1", "master"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
rf = ["rf70"]

[envs.devel.overrides]
matrix.rf.dependencies = [
{ value = "robotframework==6.1b1", if = [
"rf61b1",
] },
{ value = "robotframework @ git+https://github.com/robotframework/robotframework.git", if = [
"master",
{ value = "robotframework>=7.0, <7.1", if = [
"rf70",
] },
]

[[envs.test.matrix]]
rf = ["rf61b1", "master"]
rf = ["rf70", "master"]

[envs.test.overrides]
matrix.rf.dependencies = [
{ value = "robotframework==6.1b1", if = [
"rf61b1",
] },
{ value = "robotframework @ git+https://github.com/robotframework/robotframework.git", if = [
"master",
{ value = "robotframework==7.0, <7.1", if = [
"rf70",
] },
]

Expand Down
12 changes: 7 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ classifiers = [
"Framework :: Robot Framework :: Tool",
]
requires-python = ">=3.8"
dependencies = ["robotframework>=6.1b1"]
dependencies = ["robotframework>=7.0", "gurke == 0.0.0"]
dynamic = ["version"]


Expand All @@ -62,18 +62,20 @@ Source = "https://github.com/d-biehl/robotframework-gherkin-parser"
[tool.semantic_release]
version_variable = [
"src/GherkinParser/__version__.py:__version__",
#"packages/analyze/src/robotcode/analyze/__version__.py:__version__",
"packages/gurke/src/gurke/__version__.py:__version__",
]
version_pattern = [
'package.json:"version": "{version}"',
#"packages/analyze/pyproject.toml:\"robotcode\\S*=={version}\"",
#"pyproject.toml:\"robotcode\\S*=={version}\"",
"packages/gurke/pyproject.toml:\"robotcode\\S*=={version}\"",
"pyproject.toml:\"robotcode\\S*=={version}\"",
"pyproject.toml:\"gurke\\S*=={version}\"",
]
branch = "main"
upload_to_release = false
upload_to_repository = false
build_command = "pip install hatch && hatch build"


[tool.black]
line-length = 120
target-version = ['py38']
Expand Down Expand Up @@ -188,7 +190,7 @@ exclude = [
mypy_path = [
"typings",
"src",
#"packages/core/src",
"packages/gurke/src",
]
explicit_package_bases = true
namespace_packages = true
Expand Down
Loading

0 comments on commit bef0e6f

Please sign in to comment.