Overview

Localizing Your Acceptance Tests With The Robot Framework

No Comments

When doing acceptance test driven development, the team writes the tests often by first specifying the behaviour, and then supporting that with a table of examples. How that generally works with the Robot Framework, was already described earlier. As executable specification, those automated tests have to be understandable by all stakeholders. By all means, this includes that they should be written in everybody’s mother tounge – and more often than not, this is not English. This currently does not work with the Robot Framework, does it?
With a simple resource file, you can easily work around that issue, until it will be solved with the forthcoming Robot Framework 2.5.

*** Settings ***
 
 
*** Keywords ***
Gegeben ${keyword}
	Run Keyword  ${keyword}
 
Sei ${keyword}
	Run Keyword  ${keyword}
 
Wenn ${keyword}
	Run Keyword  ${keyword}
 
Dann ${keyword}
	Run Keyword  ${keyword}
 
Und ${keyword}
	Run Keyword  ${keyword}

Now a test can be written easily, like shown in the example below:

*** Settings ***
Resource        ${RESOURCES}/German-BDD.txt
 
*** Keyword ***
Verhalten
    [Arguments]  ${arg1}  ${xyz}
 
    Sei dies, und auch ${arg1} noch gegeben
    Und das hier ebenso
 
    Wenn dann jenes geschieht
    Und folgendes danach
 
    Dann ist diese Situation eingetreten
    Und die Daten ${xyz} befinden sich in der Datenbank
    Und übrgens, Umlaute und Kommata in Keywords funktionieren auch
 
| *Test Case* | | *arg1* | *xyz* |
| 1 | Verhalten |    123 |   234 |

Note that this even works with Umlauts and punctuation marks – in Python and in Jython. A fact, that pleasantly surprised me today 🙂

Comment

Your email address will not be published. Required fields are marked *