Recently, I wrote few features in Cucumber. Cucumber is a powerful tool which enables us to write automated tests in functional descriptions. These descriptions are as easy to comprehend, as plain English. The purpose of this tool is to perfom BDD(Behavior-Driven-Development).
Consider this small snippet from my pacf feature:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
Yes, these are tests! And they perform the operations as they say.
Featuredenotes the feature this test will cover. It is followed by the description of the feature as:As astatistician -> (use-case)So thatI can quickly evaluate pacf of a seires -> (purpose)I wantto evaluate pacf -> (expected result)
Givenis analogous tobeforein RSpec. In context ofBackground, it denotesbefore all. That is, the forementioned time-series will be available in all scenarios furhter. This timeseries is resolved by Gherkin parser. This is further resolved after parsing by following definition:
1 2 3 4 5 6 7 | |
Scenarioscover the test cases with the combination ofWhen,And,Thenkeywords. They are regular English sentences and combine to form a gramatically sound process. These sentences are then captured by regular-expressions written by programmer. For example;
1
| |
1 2 3 | |
Above will capture the lags and the strings like:
- When I provide 5 lags for pacf
- When I provide 10 lags for acf
Result: Compliant for both acf and pacf. :)
You can check my features and step definitions here.
Cheers
Ankur Goel
