I understand that both frameworks are great for acceptance testing but how hard or more complex is writing lower level tests such as integration tests or unit tests using the mentioned frameworks when compared to domain specific frameworks such as Gtest and jUnit?

I am specifically asking for C++ or Java projects. But answers regarding other projects are also appreciated.

2 Answers 2


DL;DR: It's possible, but you shouldn't.

All the tools you've mentioned are essentially test runners, meaning they execute a DSL focused on test code in someway.

JUnit and GoogleTest execute methods according to a code-based instruction*, have class/method-level mocking support, and do reporting.

On the other hand, Cucumber and Robot are focused on executing methods based on a semi-structured files written in human language, and do reporting.

In the end of the day, all of them simply execute methods you define, but the highlighted points already show the main goal of each test runner.

Code is always unambiguous - using it to describe a small piece of code behavior (a unit) is the natural way. However, for "bigger" behaviors, human language can be more beneficial.

But only for these "bigger" behaviors": Describe every single piece of work necessary to execute in isolation a small functionality is bloated - unit test runners already come with some features for creating some level of abstraction, such as @Before/@After hooks

* TestNG, e.g., uses XML


For C++ projects, I use pytest and the plugins pytest-cpp and pytest-bdd for testing everything. You can run C++ unit tests defined with, say, GoogleTest, and also acceptance tests defined using the Gherkin DSL. It really is a one-stop shop.

There are trade-offs, of course, and I'm constantly getting into debates with folks who say I should use the Robot Framework for acceptance tests, but don't care to learn Yet Another Testing DSL that's specific to a particular framework. pytest is a hill I'm willing to die on for the sake of having a single, uniform approach to testing that allows all tests, or any subset of them I choose, to be run with a single test runner.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.