1

I am using robot framework as the main test framework with selenium (+ python libraries) to test web ui. I'm having issues with continuous integration in Jenkins and need to change the screenshot name (that is being assigned automatically with index (selenium-screenshot-{index}.png) to more unique name for several test cases eq.:

${TEST NAME}-screen-{index}.png

I know how to access automatic varibales, but how do I set the automatic generation name to something other than selenium-screenshot on Suite Setup/ beggining of the tests level?

Tried using Set Screenshot Directory to make it more unique for test suites but filenames are still the issue. Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.

2 Answers 2

2

Also using keyword to capture screenshot and setting the name there is not enough, as some keywords make screenshots on failure and they are still being named with selenium-screenshot convention.

You could create your own custom keyword that would handle naming and run on failure. You could use Register Keyword To Run On Failure in Suite Setup to specify which keyword to run on failure.

Sign up to request clarification or add additional context in comments.

1 Comment

Works great, thanks :) For anyone who might also wonder: Register Keyword To Run On Failure works ONLY for selenium keywords (so it won't run when custom keywords are executed)
0

Final resolution:

Screenshot On Failure
  [Documentation]  Keyword to overwrite the basic screenshot on failure method
  Capture Page Screenshot  ${TEST NAME}-screen-{index}.png

and then add it to:

Register Keyword To Run On Failure  Screenshot On Failure

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.