Interesting. Are you planning to implement a generic database library
or something that is dependent on your application under test? I know
others would be interested about a generic db library too.
> However, it is not possible to perform both these operations(throwing
> an exception and returning value) at the same time.
> So the keyword can either return a pass/fail status or return a value.
> Is there anyway to pass the status and return value to the robot
> framework simultaneously?
Yes, keyword can either return a value or throw an exception and fail.
If there is no exception the keyword is considered to pass so that
status is communicated implicitly. Since the test execution ends if a
keyword fails (i.e. throws an exception), the return value couldn't be
used for anything even if you could return it.
Sometime there might be a need to first return return something from a
keyword, then do something with the return value and finally decide
the test case status based on the return value. This can be done be
always returning a value from the keyword and never failing it (or
failing it only in unexpected error situations). You can either add
the status to the return value or return multiple values as explained
in the user guide [1]. The latter approach could then be used to
construct something like this:
| ${return_value} | ${status} = | My Keyword |
| Do Something | ${return_value} |
| Should Be Equal | ${status} | PASS |
Cheers,
.peke