Skip to content

Commit f59a097

Browse files
authored
Merge pull request #32 from JFoederer/configurable-generator-settings
Configurable generator settings
2 parents fe67029 + 4290727 commit f59a097

21 files changed

Lines changed: 240 additions & 49 deletions
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
from robot.api.deco import not_keyword
2-
31
class MyProcessor:
4-
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
52

6-
@not_keyword
73
def process_test_suite(self, in_suite):
84
self.in_suite = in_suite
95
self._fail_on_step_errors()
@@ -17,7 +13,7 @@ def process_test_suite(self, in_suite):
1713

1814
def _fail_on_step_errors(self):
1915
if self.in_suite.has_error():
20-
raise Exception("Error(s) detected in at least one step")
21-
22-
def reported_errors(self):
23-
return self.in_suite.steps_with_errors()
16+
msg = "\n".join(["Error(s) detected in at least one step"] +
17+
[f"{step.kw_wo_gherkin} FAILED: {step.model_info['error']}"
18+
for step in self.in_suite.steps_with_errors()])
19+
raise Exception(msg)

atest/robotMBT tests/03__parse_model_info/incorrect_model_info.robot

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,48 @@ Library robotmbt processor_lib=MyProcessor
55

66
*** Test Cases ***
77
fail on empty model info
8+
Confirm expected error then pass execution empty model info When present, *model info* cannot be empty
89
empty model info
910

1011
fail when colon syntax isn't used
12+
Confirm expected error then pass execution non-colon model info *model info* expected format: :<attr>: <expr>|<expr>
1113
non-colon model info
1214

1315
fail when colon syntax is used incorrectly
16+
Confirm expected error then pass execution forgotten opening colon *model info* expected format: :<attr>: <expr>|<expr>
1417
forgotten opening colon
1518

1619
fail on non-existing keyword
17-
Confirm expected error then pass execution 3 No keyword with name 'non-existing keyword' found.
20+
Confirm expected error then pass execution non-existing keyword No keyword with name 'non-existing keyword' found.
1821
non-existing keyword
1922

2023
fail on non-existing step with prefix
21-
Confirm expected error then pass execution 4 No keyword with name 'when non-existing step' found.
24+
Confirm expected error then pass execution non-existing step No keyword with name 'when non-existing step' found.
2225
when non-existing step
2326

2427
*** Keywords ***
2528
Expect failing suite processing
26-
[Documentation] *model info*
27-
... :IN: None
28-
... :OUT: None
29-
Run keyword and expect error Error(s) detected* Treat this test suite Model-based
30-
Set suite variable ${expected_error_detected} ${True}
29+
${msg}= Run keyword and expect error Error(s) detected* Treat this test suite Model-based
30+
Set suite variable ${full_message} ${msg}
3131

3232
empty model info
3333
[Documentation] *model info*
34-
@{errors}= Reported errors
35-
Should be equal ${errors[0].kw_wo_gherkin} empty model info
34+
Fail Unreachable keyword executed
3635

3736
non-colon model info
3837
[Documentation] *model info*
3938
... *IN* Alfa
4039
... *OUT* Beta | Gamma delta | Epsilon
41-
@{errors}= Reported errors
42-
Should be equal ${errors[1].kw_wo_gherkin} non-colon model info
40+
Fail Unreachable keyword executed
4341

4442
forgotten opening colon
4543
[Documentation] *model info*
4644
... IN: Alfa
4745
... OUT: Beta | Gamma delta | Epsilon
48-
@{errors}= Reported errors
49-
Should be equal ${errors[2].kw_wo_gherkin} forgotten opening colon
46+
Fail Unreachable keyword executed
5047

5148
Confirm expected error then pass execution
52-
[Arguments] ${index} ${error_message}
49+
[Arguments] ${step_name} ${error_message}
5350
[Documentation] *model info*
5451
... :IN: None
5552
... :OUT: None
@@ -58,8 +55,5 @@ Confirm expected error then pass execution
5855
... then this keyword causes the remainder of the scenario to be skipped and
5956
... the test passes. When inserted without the correct error, the scenario
6057
... will fail.
61-
@{errors}= Reported errors
62-
Should be equal ${errors[${index}].model_info['error']} ${error_message}
63-
IF ${expected_error_detected}
64-
Pass execution Accepting intentionally unexecutable scenario
65-
END
58+
Should Contain ${full_message} ${step_name} FAILED: ${error_message}
59+
Pass execution Accepting intentionally unexecutable scenario

atest/robotMBT tests/05__repeating_scenarios/07__repetition_with_refinement.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ low-level scenario
2424

2525
At least 3 people can write their name on the card
2626
Given the birthday card has 2 names written on it
27-
when Someone writes their name on the birthday card
27+
when Someone writes their name in pen on the birthday card
2828
then the birthday card has 3 names written on it
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Treat this test suite Model-based repeat=2
4+
Suite Teardown Should be equal ${test_count} ${2}
5+
Library SuiteRepeater.py
6+
Library robotmbt processor_lib=SuiteRepeater
7+
8+
*** Test Cases ***
9+
only test case
10+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Set model-based options repeat=2
4+
... AND Treat this test suite Model-based
5+
Suite Teardown Should be equal ${test_count} ${2}
6+
Library SuiteRepeater.py
7+
Library robotmbt processor_lib=SuiteRepeater
8+
9+
*** Test Cases ***
10+
only test case
11+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Set model-based options repeat=2
4+
... AND Update model-based options repeat=3
5+
... AND Treat this test suite Model-based
6+
Suite Teardown Should be equal ${test_count} ${3}
7+
Library SuiteRepeater.py
8+
Library robotmbt processor_lib=SuiteRepeater
9+
10+
*** Test Cases ***
11+
only test case
12+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Set model-based options repeat=2
4+
... AND Treat this test suite Model-based repeat=3
5+
Suite Teardown Should be equal ${test_count} ${3}
6+
Library SuiteRepeater.py
7+
Library robotmbt processor_lib=SuiteRepeater
8+
9+
*** Test Cases ***
10+
only test case
11+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Update model-based options repeat=2
4+
... AND Treat this test suite Model-based
5+
Suite Teardown Should be equal ${test_count} ${2}
6+
Library SuiteRepeater.py
7+
Library robotmbt processor_lib=SuiteRepeater
8+
9+
*** Test Cases ***
10+
only test case
11+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Treat this test suite Model-based repeat=2 bonus_scenario=${True}
4+
Suite Teardown Should be equal ${test_count} ${3}
5+
Library SuiteRepeater.py
6+
Library robotmbt processor_lib=SuiteRepeater
7+
8+
*** Test Cases ***
9+
only test case
10+
Set suite variable ${test_count} ${test_count+1}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*** Settings ***
2+
Suite Setup Run keywords Set suite variable ${test_count} ${0}
3+
... AND Set model-based options repeat=2 bonus_scenario=${True}
4+
... AND Set model-based options repeat=2
5+
... AND Treat this test suite Model-based
6+
Suite Teardown Should be equal ${test_count} ${2}
7+
Library SuiteRepeater.py
8+
Library robotmbt processor_lib=SuiteRepeater
9+
10+
*** Test Cases ***
11+
only test case
12+
Set suite variable ${test_count} ${test_count+1}

0 commit comments

Comments
 (0)