Skip to content

Commit 9e37724

Browse files
committed
new test for data consistency in split-up scenarios
1 parent d28694f commit 9e37724

10 files changed

Lines changed: 79 additions & 13 deletions

atest/resources/birthday_cards_data_variation.resource

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ the birthday card has ${n} different names written on it
6161
[Documentation] *model info*
6262
... :IN: len(set(birthday_card.names)) == ${n}
6363
... :OUT: len(set(birthday_card.names)) == ${n}
64-
Length should be ${names} ${{int(${n})}}
64+
Length should be ${{set(${names})}} ${{int(${n})}}
6565

6666
${person} signs the birthday card
6767
[Documentation] *model info*

atest/robotMBT tests/06__data_variation/01__equivalence_partitioning.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Suite Setup Treat this test suite Model-based
88
Resource ../../resources/birthday_cards_data_variation.resource
99
Library robotmbt
1010

11+
1112
*** Test Cases ***
1213
Background
1314
Given Bahar is having their birthday

atest/robotMBT tests/06__data_variation/02__equivalence_partitioning_double_data.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Suite Setup Treat this test suite Model-based
99
Resource ../../resources/birthday_cards_data_variation.resource
1010
Library robotmbt
1111

12+
1213
*** Test Cases ***
1314
Background
1415
Given Bahar is having their birthday

atest/robotMBT tests/06__data_variation/03__refinement_with_data_reuse.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Suite Setup Treat this test suite Model-based
99
Resource ../../resources/birthday_cards_data_variation.resource
1010
Library robotmbt
1111

12+
1213
*** Test Cases ***
1314
Background
1415
Given Bahar is having their birthday

atest/robotMBT tests/06__data_variation/04__refinement_with_data_fan_out.robot

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
*** Settings ***
22
Documentation This suite uses refinement and equivalence partitioning. The high-level scenario
33
... requires just a single key example from the equivalence class and uses just one
4-
... concrete example. This scenario is then refined by two more detailed examples
5-
... that use 2 different actors with specific characters. One is concise, the other
6-
... a bit more elaborate. This implies that for at least one set of examples the
7-
... high-level scenario's example value does not match the low-level scenario's
8-
... example value. They must however still be matched, and kept identical, under
9-
... refinement.
4+
... concrete example. This scenario can be refined by two more detailed examples
5+
... that use 2 different actors. This implies that one refinement example will match
6+
... the high-level scenario's example, the other does not. To complete the trace,
7+
... the high-level scenario must be repeated, once with each possible refinement.
8+
... The example values between the high- and low-level scenarios must be matched,
9+
... and kept identical, under refinement.
1010
Suite Setup Treat this test suite Model-based
1111
Resource ../../resources/birthday_cards_data_variation.resource
1212
Library robotmbt
1313

14+
1415
*** Test Cases ***
1516
Background
1617
Given Bahar is having their birthday
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
*** Settings ***
2+
Documentation This suite is an extension to the 'data fan out' suite, which needed refinement
3+
... for just a single step. Here, the high-level scenario needs refinement in three
4+
... of its steps. The background defines three actors and there are three refinement
5+
... scenarios available. One for each actor. However, the high-level scenario only
6+
... uses two of the actors, forcing the model to match up two of the steps and to
7+
... never use the third option. The test fails if the model does not properly keep
8+
... its data choices over all its steps when splitting the high-level scenario, and
9+
... picks data independently in each step.
10+
Suite Setup Treat this test suite Model-based
11+
Resource ../../resources/birthday_cards_data_variation.resource
12+
Library robotmbt
13+
14+
15+
*** Test Cases ***
16+
Background
17+
Given Bahar is having their birthday
18+
and Johan is a friend of Bahar
19+
and Tannaz is a friend of Bahar
20+
and Frederique is a friend of Bahar
21+
When Johan buys a birthday card
22+
then there is a blank birthday card available
23+
24+
A friend signs the birthday card
25+
Given there is a birthday card
26+
when Johan signs the birthday card
27+
and Tannaz signs the birthday card
28+
and Johan signs the birthday card again
29+
then the birthday card has a personal touch
30+
and the birthday card has 2 different names written on it
31+
32+
Signing the birthday card with your name only
33+
Given there is a birthday card
34+
and Johan is signing the birthday card
35+
when Johan writes their name on the birthday card
36+
then the birthday card has 'Johan' written on it
37+
38+
Signing the birthday card with: Happy birthday!
39+
Given there is a birthday card
40+
and Tannaz is signing the birthday card
41+
when Tannaz writes their name on the birthday card
42+
and Tannaz adds the wish 'Happy birthday!' to the birthday card
43+
then the birthday card has 'Tannaz' written on it
44+
and the birthday card proclaims: Happy birthday!
45+
46+
Signing the birthday card with: Cheers!
47+
Given there is a birthday card
48+
and Frederique is signing the birthday card
49+
when Frederique writes their name on the birthday card
50+
and Frederique adds the wish 'Cheers!' to the birthday card
51+
then the birthday card has 'Frederique' written on it
52+
and the birthday card proclaims: Cheers!
53+
54+
55+
*** Keywords ***
56+
${person} signs the birthday card again
57+
[Documentation] Similar to '${person} signs the birthday card', but
58+
... without the check that the name is not already on there.
59+
...
60+
... *model info*
61+
... :MOD: ${person}= [guest for guest in party.guests]
62+
... :IN: scenario.guest = ${person} | scenario.count = len(birthday_card.names)
63+
... :OUT: len(birthday_card.names) == scenario.count+1
64+
Should contain ${names} ${person}

atest/robotMBT tests/06__data_variation/05__interacting_equivalence_classes.robot renamed to atest/robotMBT tests/06__data_variation/06__interacting_equivalence_classes.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Suite Setup Treat this test suite Model-based
1212
Resource ../../resources/birthday_cards_data_variation.resource
1313
Library robotmbt
1414

15+
1516
*** Test Cases ***
1617
Background
1718
Given Johan is having their birthday

atest/robotMBT tests/06__data_variation/06__independent_equivalence_classes.robot renamed to atest/robotMBT tests/06__data_variation/07__independent_equivalence_classes.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Suite Setup Treat this test suite Model-based
1212
Resource ../../resources/birthday_cards_data_variation.resource
1313
Library robotmbt
1414

15+
1516
*** Test Cases ***
1617
Background
1718
Given Bahar is having their birthday

atest/robotMBT tests/06__data_variation/07__define_example_values_in_then_step.robot renamed to atest/robotMBT tests/06__data_variation/08__define_example_values_in_then_step.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Documentation This test suite focuses on the initialisation of model data fr
1515
Suite Setup Treat this test suite Model-based
1616
Library robotmbt
1717

18+
1819
*** Test Cases ***
1920
Background
2021
Given Bahar is throwing a party for their friends

robotmbt/suiteprocessors.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,7 @@ def __last_candidate_changed_nothing(tracestate):
145145

146146
def _select_scenario_variant(self, candidate_id, tracestate):
147147
candidate = self._scenario_with_repeat_counter(candidate_id, tracestate)
148-
if candidate_id in tracestate.active_refinements:
149-
# reuse previous solution for all parts in split-up scenario
150-
candidate = candidate.copy()
151-
candidate.data_choices = tracestate.get_remainder(candidate_id).data_choices.copy()
152-
else:
153-
candidate = self._generate_scenario_variant(candidate, tracestate.model or ModelSpace())
148+
candidate = self._generate_scenario_variant(candidate, tracestate.model or ModelSpace())
154149
return candidate
155150

156151
def _scenario_with_repeat_counter(self, index, tracestate):

0 commit comments

Comments
 (0)