Robot Framework - Feature found :-) - codecentric AG Blog
Well-fitting to easter I yesterday stumbled on exactly that feature in the Robot Framework that I was missing ever since I am using the tool and that was there in front of my nose all the time … but first things first.
When automating tests there are almost always some properties that depend on the environment where the tests are executed in. Some classic ones are URLs (servernames) for Tests using Selenium or some login information for the database used. Those values will be most likely different on the developer’s machines and the CI environment. Therefore these properties must be “somehow” passed as parameters to the tests, well, to the corresponding keywords to be precise. The Robot Framework supports this with these kind of command line arguments: “–variable NAME:VALUE”. But when having two or more parameters this is already quite confusing and hard to maintain.
Thus I was asking myself already for quite a long time why there is no possibility to pass such variable definitions using a file. And as it has turned out now I was simply overlooking this part of the Robot Framework User Guide all the time. And one cannot really say that this is hidden there somehow as the paragraph itself is called Variable Files, which could really be seen as a kind of hint here. Only excuse is that I was properly scared as this was mentioned in the context of Python ;-).
But in the end this is exactly what I was looking for because – despite the “Python-thing” – those Variable-Files are looking exactly like plain property files. Those can then be included in the corresponding startup scripts using “–variablefile <path>”. This way one can easily create pairs of startup scripts and corresponding property files for different environments.
It is definitly great to find exactly that feature one was missing long time and this even without the need to have a new version of the tool … to take oneself by surprise like this is really beyond price :-).