mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-28 17:20:22 +00:00
add support for RobotFramework .robot files
This commit is contained in:
@@ -1187,6 +1187,12 @@ Rebol:
|
||||
Redcode:
|
||||
primary_extension: .cw
|
||||
|
||||
RobotFramework:
|
||||
type: programming
|
||||
primary_extension: .robot
|
||||
# extensions:
|
||||
# - .txt
|
||||
|
||||
Rouge:
|
||||
type: programming
|
||||
lexer: Clojure
|
||||
|
||||
45
samples/RobotFramework/data_driven.robot
Normal file
45
samples/RobotFramework/data_driven.robot
Normal file
@@ -0,0 +1,45 @@
|
||||
*** Settings ***
|
||||
Documentation Example test cases using the data-driven testing approach.
|
||||
...
|
||||
... Tests use `Calculate` keyword created in this file, that in
|
||||
... turn uses keywords in `CalculatorLibrary`. An exception is
|
||||
... the last test that has a custom _template keyword_.
|
||||
...
|
||||
... The data-driven style works well when you need to repeat
|
||||
... the same workflow multiple times.
|
||||
...
|
||||
... Notice that one of these tests fails on purpose to show how
|
||||
... failures look like.
|
||||
Test Template Calculate
|
||||
Library CalculatorLibrary
|
||||
|
||||
*** Test Cases *** Expression Expected
|
||||
Addition 12 + 2 + 2 16
|
||||
2 + -3 -1
|
||||
|
||||
Subtraction 12 - 2 - 2 8
|
||||
2 - -3 5
|
||||
|
||||
Multiplication 12 * 2 * 2 48
|
||||
2 * -3 -6
|
||||
|
||||
Division 12 / 2 / 2 3
|
||||
2 / -3 -1
|
||||
|
||||
Failing 1 + 1 3
|
||||
|
||||
Calculation error [Template] Calculation should fail
|
||||
kekkonen Invalid button 'k'.
|
||||
${EMPTY} Invalid expression.
|
||||
1 / 0 Division by zero.
|
||||
|
||||
*** Keywords ***
|
||||
Calculate
|
||||
[Arguments] ${expression} ${expected}
|
||||
Push buttons C${expression}=
|
||||
Result should be ${expected}
|
||||
|
||||
Calculation should fail
|
||||
[Arguments] ${expression} ${expected}
|
||||
${error} = Should cause error C${expression}=
|
||||
Should be equal ${expected} ${error} # Using `BuiltIn` keyword
|
||||
33
samples/RobotFramework/gherkin.robot
Normal file
33
samples/RobotFramework/gherkin.robot
Normal file
@@ -0,0 +1,33 @@
|
||||
*** Settings ***
|
||||
Documentation Example test case using the gherkin syntax.
|
||||
...
|
||||
... This test has a workflow similar to the keyword-driven
|
||||
... examples. The difference is that the keywords use higher
|
||||
... abstraction level and their arguments are embedded into
|
||||
... the keyword names.
|
||||
...
|
||||
... This kind of _gherkin_ syntax has been made popular by
|
||||
... [http://cukes.info|Cucumber]. It works well especially when
|
||||
... tests act as examples that need to be easily understood also
|
||||
... by the business people.
|
||||
Library CalculatorLibrary
|
||||
|
||||
*** Test Cases ***
|
||||
Addition
|
||||
Given calculator has been cleared
|
||||
When user types "1 + 1"
|
||||
and user pushes equals
|
||||
Then result is "2"
|
||||
|
||||
*** Keywords ***
|
||||
Calculator has been cleared
|
||||
Push button C
|
||||
|
||||
User types "${expression}"
|
||||
Push buttons ${expression}
|
||||
|
||||
User pushes equals
|
||||
Push button =
|
||||
|
||||
Result is "${result}"
|
||||
Result should be ${result}
|
||||
37
samples/RobotFramework/keyword_driven.robot
Normal file
37
samples/RobotFramework/keyword_driven.robot
Normal file
@@ -0,0 +1,37 @@
|
||||
*** Settings ***
|
||||
Documentation Example test cases using the keyword-driven testing approach.
|
||||
...
|
||||
... All tests contain a workflow constructed from keywords in
|
||||
... `CalculatorLibrary`. Creating new tests or editing existing
|
||||
... is easy even for people without programming skills.
|
||||
...
|
||||
... This kind of style works well for normal test automation.
|
||||
... If also business people need to understand tests, using
|
||||
... _gherkin_ style may work better.
|
||||
Library CalculatorLibrary
|
||||
|
||||
*** Test Cases ***
|
||||
Push button
|
||||
Push button 1
|
||||
Result should be 1
|
||||
|
||||
Push multiple buttons
|
||||
Push button 1
|
||||
Push button 2
|
||||
Result should be 12
|
||||
|
||||
Simple calculation
|
||||
Push button 1
|
||||
Push button +
|
||||
Push button 2
|
||||
Push button =
|
||||
Result should be 3
|
||||
|
||||
Longer calculation
|
||||
Push buttons 5 + 4 - 3 * 2 / 1 =
|
||||
Result should be 3
|
||||
|
||||
Clear
|
||||
Push button 1
|
||||
Push button C
|
||||
Result should be ${EMPTY} # ${EMPTY} is a built-in variable
|
||||
Reference in New Issue
Block a user