Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scenario with output parameters (alpha)
- Loading branch information
Showing
22 changed files
with
438 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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
43 changes: 43 additions & 0 deletions
43
...SuiteSlimTests/ScenarioTestSuite/ScenarioWithOutputParametersInDecisionTables/content.txt
This file contains 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,43 @@ | ||
Output parameters in scenarios are flagged with a question mark in the header row, like in decision tables. | ||
For each output parameter a symbol with the same name must be assigned a value in the scenario. | ||
|
||
See below a sample of a division scenario with output parameter "result" | ||
|
||
|scenario | my division |numerator| | denominator| | result?| | ||
|setNumerator| @numerator| | ||
|setDenominator| @denominator| | ||
|$result= | quotient| | ||
|
||
|
||
Get the Division implementation from the eg package | ||
|Library| | ||
|eg.Division| | ||
|
||
|
||
|
||
| my division | | ||
| numerator | denominator | result? | | ||
| 10 | 2 | $x= | | ||
| $x | 1 | 5.0 | | ||
|
||
|
||
!3 A result calculated in one row and assigned to a symbol can be used in the next row | ||
and the order of the columns doesn't matters | ||
|
||
| my division | | ||
| result? | numerator | denominator | | ||
| $x= | 1000 | 2 | | ||
| $x= | $x | 2 | | ||
| $x= | $x | 2 | | ||
| $x= | $x | 2 | | ||
| $x= | $x | 2 | | ||
| $x= | $x | 2 | | ||
|7.8125 | $x | 2 | | ||
|
||
!3 A result can be used in multiple columns in the decion table to do different checks | ||
| my division | | ||
| numerator | denominator | result? | result?| | ||
| 10 | 2 | 5.0 | < 7.0| | ||
| 12.6 | 3 | 4.2 | > 3.0| | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
...teSlimTests/ScenarioTestSuite/ScenarioWithOutputParametersInDecisionTables/properties.xml
This file contains 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,13 @@ | ||
<?xml version="1.0"?> | ||
<properties> | ||
<Edit>true</Edit> | ||
<Files>true</Files> | ||
<LastModifyingUser>six42</LastModifyingUser> | ||
<Properties>true</Properties> | ||
<RecentChanges>true</RecentChanges> | ||
<Refactor>true</Refactor> | ||
<Search>true</Search> | ||
<Test>true</Test> | ||
<Versions>true</Versions> | ||
<WhereUsed>true</WhereUsed> | ||
</properties> |
47 changes: 47 additions & 0 deletions
47
...eTests/SuiteSlimTests/ScenarioTestSuite/ScenarioWithOutputParametersInScripts/content.txt
This file contains 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,47 @@ | ||
!1 Scripts can call scenarios with output parameters | ||
|
||
Output parameters in scenarios are flagged with a question mark in the header row, like in decision tables. | ||
For each output parameter a symbol with the same name must be assigned a value in the scenario. | ||
|
||
In the calling script you can than access the output parameter. | ||
A scenario can have also more than one output parameter | ||
|
||
See below a sample of a division scenario with output parameter "quotient" | ||
|
||
|scenario | Mydivision |numerator| | denominator| | quotient?| | ||
|setNumerator| @numerator| | ||
|setDenominator| @denominator| | ||
|$quotient= | quotient| | ||
|
||
|
||
Get the Division implementation from the eg package | ||
|Library| | ||
|eg.Division| | ||
|
||
The recommended syntax to call the scnario from a script is as below | ||
|
||
|script| | ||
|Mydivision; |35| 5 | | ||
|check |echo| $quotient| 7.0| | ||
|
||
|script| | ||
| Mydivision |40| | 4| | | ||
|check |echo| $quotient| 10.0| | ||
|
||
The below is not recommended and might not work in the future | ||
|script| | ||
| Mydivision |40| | 10| | _| | ||
|check |echo| $quotient| 4.0| | ||
|
||
|script| | ||
|Mydivision; |35 |5| _ | | ||
|check |echo| $quotient| 7.0| | ||
|
||
|
||
The following syntax is currently not working | ||
!|script| | ||
|# Mydivision 35 5 | | ||
|# check |echo| $quotient| 7.0| | ||
|
||
|
||
|
13 changes: 13 additions & 0 deletions
13
...sts/SuiteSlimTests/ScenarioTestSuite/ScenarioWithOutputParametersInScripts/properties.xml
This file contains 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,13 @@ | ||
<?xml version="1.0"?> | ||
<properties> | ||
<Edit>true</Edit> | ||
<Files>true</Files> | ||
<LastModifyingUser>six42</LastModifyingUser> | ||
<Properties>true</Properties> | ||
<RecentChanges>true</RecentChanges> | ||
<Refactor>true</Refactor> | ||
<Search>true</Search> | ||
<Test>true</Test> | ||
<Versions>true</Versions> | ||
<WhereUsed>true</WhereUsed> | ||
</properties> |
64 changes: 64 additions & 0 deletions
64
...ests/ScenarioTestSuite/UsingConstructorArgumentsFromDecisionTablesInScenarios/content.txt
This file contains 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,64 @@ | ||
If a decision table is implemented with a class you can specify constructor arguments. | ||
See .FitNesse.UserGuide.WritingAcceptanceTests.SliM.ConstructorArguments for details. | ||
|
||
If a decision table is implemented with a scenario you can specify constructor arguments as well they have the following meaning: | ||
|
||
|scenario | Division _ _ _|numerator, denominator, quotient?| | ||
|setNumerator| @numerator| | ||
|setDenominator| @denominator| | ||
|$quotient= | quotient| | ||
|
||
|library| | ||
|eg.Division| | ||
|
||
!3 Calling a Scenario with Constructor Parameters | ||
|
||
The input variable "numerator" is given on the table construction line and must not be repeated in each row. | ||
This can make the decison tables more readable. | ||
|
||
| Division | having |numerator| 9| | ||
| denominator | quotient? | | ||
| 3 | 3.0 | | ||
| 2 | 4.5 | | ||
|
||
The Syntax is - Scenario Name - [given|having] - 1. Variable Name - 1. Variable Value - 2. Variable Name - 2. Variable Value - .... | ||
|
||
!5 To ensure backward compatibility constructor parameters are first checked if they are part of a scenario name | ||
If a senario is found it will be used and no constructor values are passed. | ||
Only if no such scenario is found the constructor parameters can be used. | ||
|
||
Example: | ||
|
||
Again a scenario with the same signature as above | ||
|scenario | Division _ _ _|numerator, denominator, quotient?| | ||
|check| echo | @numerator|7| | ||
|
||
| Division | having |numerator| 7| | ||
| denominator | | ||
| 3 | | ||
|
||
Now a higher priority scenario name | ||
This new scenario has a name which matches the constructor parameter name "numerator". | ||
Calling again the same decision table will use this scenario. | ||
But numerator will not have a value. | ||
|scenario | Division Numerator _ _ _| numerator, denominator, quotient?| | ||
|check| echo | @numerator|@numerator| | ||
|check not |echo| @numerator|12| | ||
|
||
|
||
| Division | having |numerator| 12| | ||
| denominator | | ||
| 3 | | ||
|
||
!3 Scenario without output parameters can be used as well with constructor parameters | ||
In this case the full line will be collered with the scenario test result. In scenarios with output parameters only the output column cells are colored. | ||
|scenario | myDivision _ _ _|numerator, denominator, quotient| | ||
|setNumerator| @numerator| | ||
|setDenominator| @denominator| | ||
|check | quotient| @quotient | | ||
|
||
| myDivision | having |numerator| 12| | ||
| denominator |quotient| | ||
| 3 | 4.0| | ||
|6|2.0| | ||
|4|3.0| |
13 changes: 13 additions & 0 deletions
13
...s/ScenarioTestSuite/UsingConstructorArgumentsFromDecisionTablesInScenarios/properties.xml
This file contains 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,13 @@ | ||
<?xml version="1.0"?> | ||
<properties> | ||
<Edit>true</Edit> | ||
<Files>true</Files> | ||
<LastModifyingUser>six42</LastModifyingUser> | ||
<Properties>true</Properties> | ||
<RecentChanges>true</RecentChanges> | ||
<Refactor>true</Refactor> | ||
<Search>true</Search> | ||
<Test>true</Test> | ||
<Versions>true</Versions> | ||
<WhereUsed>true</WhereUsed> | ||
</properties> |
2 changes: 2 additions & 0 deletions
2
FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/ScenarioTestSuite/content.txt
This file contains 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,2 @@ | ||
!1 !help | ||
!contents -R2 -g -p -f -h |
14 changes: 14 additions & 0 deletions
14
FitNesseRoot/FitNesse/SuiteAcceptanceTests/SuiteSlimTests/ScenarioTestSuite/properties.xml
This file contains 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,14 @@ | ||
<?xml version="1.0"?> | ||
<properties> | ||
<Edit>true</Edit> | ||
<Files>true</Files> | ||
<Help>Test suite for Scenario Defintions</Help> | ||
<Properties>true</Properties> | ||
<RecentChanges>true</RecentChanges> | ||
<Refactor>true</Refactor> | ||
<Search>true</Search> | ||
<Suite>true</Suite> | ||
<Suites></Suites> | ||
<Versions>true</Versions> | ||
<WhereUsed>true</WhereUsed> | ||
</properties> |
This file contains 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 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 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 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 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.