4

I am exploring the use of Robot Framework for writing unit tests in Python. We currently have some pre-existing unit tests that were developed using pytest. The unit-tests mock certain functionalities using the mock.patch method (such as connecting to and reading from DBs). Is there an equivalent mock functionality in Robot? Or should one have to write libraries to do it? I am very much a newbie when it comes to Robot and unit tests, so please go gentle on me :)

1 Answers1

1

From a Stack Overflow perspective this question is quite broad. Luckily the answer to this question can be determined from the Robot Framework site:

Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD).

Although you can integrate it with a unit test framework through custom Python development, the real question is whether you should. In-line with the above definition I'd recommend not mixing the Unit test layer with your other (Integration, Acceptance etc) test layers and keeping them separate.

Define a test approach with layers so that each layer builds upon the confidence obtained from the previous ones. This will reduce the scope of testing in each following layer and thus the overall complexity of your test setup.

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
  • 1
    OK, but when you develop own test framework (using Robot) you could also need to verify if it tests well, or rather "how it handles a fail". Even on the acceptance level, you need to act as the tested object fails, it's impossible without mocking. – Mikaelblomkvistsson Sep 28 '22 at 09:57