#gtest — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #gtest, aggregated by home.social.
-
Покрытие процедурного кода в ООП проекте юнит-тестами в C++
Legacy проекты на С++ зачастую являются многокомпонентными, когда продукт использует несколько библиотек, которые имеют различную архитектуру для работы с ними. Обычно это: библиотеки, поставляемые как ООП решение (Некоторые модули boost, SOCI как пример) библиотеки, реализованные в функциональном стиле (OpenGL через С API, POSIX как пример) Из-за этого в итоговом проекте появляются сущности, которые внутри реализованы через классы, но внутри методов класса идет обращение к обычным функциям. Некоторые библиотеки имеют специфичные функции, которые для своей работы требуют первоначальную инициализацию. Как пример: поиск подключенных устройств и получение на них ссылок для дальнейшей работы или функции, которые требуют инициализации большого количества памяти. Вследствие этого возникает вопрос - как лучше реализовать покрытие юнит-тестами специфичных объектов, которые внутри себя имеют функции, требующие специальных условий для своей работы?
https://habr.com/ru/companies/megafon/articles/914372/
#c++ #gtest #google_testing_framework #mocking #unittesting #unittests
-
We've been working toward deprecating GTest for our testing library in favor of our in-house JTest testing library. J3ML our 3D math library is the current target for rewriting our unit tests to utilize JTest.
-
Okay, so when using #gtest / #gmock / #googletest to write C++ unit tests for code that uses dependency injection, how the *hell* do go about mocking dependencies of a class under test without having to mock the dependency class' dependencies, and *those* class' dependencies, and so on until you've mocked every class in the dependency tree of the class under test?
"Interfaces" or "templates" are *not* valid answers, as they drive complexity into your non-test code purely to support testing!
-
Okay, so when using #gtest / #gmock / #googletest to write C++ unit tests for code that uses dependency injection, how the *hell* do go about mocking dependencies of a class under test without having to mock the dependency class' dependencies, and *those* class' dependencies, and so on until you've mocked every class in the dependency tree of the class under test?
"Interfaces" or "templates" are *not* valid answers, as they drive complexity into your non-test code purely to support testing!
-
Okay, so when using #gtest / #gmock / #googletest to write C++ unit tests for code that uses dependency injection, how the *hell* do go about mocking dependencies of a class under test without having to mock the dependency class' dependencies, and *those* class' dependencies, and so on until you've mocked every class in the dependency tree of the class under test?
"Interfaces" or "templates" are *not* valid answers, as they drive complexity into your non-test code purely to support testing!
-
Okay, so when using #gtest / #gmock / #googletest to write C++ unit tests for code that uses dependency injection, how the *hell* do go about mocking dependencies of a class under test without having to mock the dependency class' dependencies, and *those* class' dependencies, and so on until you've mocked every class in the dependency tree of the class under test?
"Interfaces" or "templates" are *not* valid answers, as they drive complexity into your non-test code purely to support testing!
-
Okay, so when using #gtest / #gmock / #googletest to write C++ unit tests for code that uses dependency injection, how the *hell* do go about mocking dependencies of a class under test without having to mock the dependency class' dependencies, and *those* class' dependencies, and so on until you've mocked every class in the dependency tree of the class under test?
"Interfaces" or "templates" are *not* valid answers, as they drive complexity into your non-test code purely to support testing!