From the course: Robot Framework Test Automation: Level 2

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Return values from keywords

Return values from keywords

- [Bryan] In the level one course, when we were testing things, we pretty much, were passing information into keywords, and then relying on some kind of assertion to know whether the test case passed or failed. There are times when you'd like for your scripts to be a little more sophisticated than that. And, what that means is, a given keyword can call another keyword to do some work, and then have that keyword pass information back to the original keyword that made the call, and that top-level keyword can make a decision about whether that was a good or bad thing, and then make an assertion from there. So, the way we can return values from keywords, is simply to declare a local variable, and assign it's value to a keyword which contains a return statement. Then, in that keyword, add another line with square brackets, and the word return, and then pass back anything you'd like to return. And, that could be a string, or an integer, or even multiple values if the variable you're…

Contents