This is my first time setting up testing.
I created a new project, imported GTest and followed a tutorial on how to do it.
When I run the tests i see that it passes but it writes “SKIPPED”…
Output when i run “pio test -vv”:
PS C:\Users\razib\Desktop\Projects\Old Computer Projects\Laser Tag\Repository\laser-tag\laser-tag-v2> pio test -v
Collected 1 tests (test_native)
Processing test_native in native environment
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Building...
Testing...
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from example
[ RUN ] example.test_if_returns_sum_of_two_given_ints
[ OK ] example.test_if_returns_sum_of_two_given_ints (0 ms)
[----------] 1 test from example (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[ PASSED ] 1 test.
---------------------------------------------------------- native:test_native [PASSED] Took 14.58 seconds ----------------------------------------------------------
============================================================================= SUMMARY =============================================================================
Environment Test Status Duration
------------- ----------- -------- ------------
d1 test_native SKIPPED
native test_native SKIPPED 00:00:14.577
============================================================ 0 test cases: 0 succeeded in 00:00:14.577 ============================================================
PS C:\Users\razib\Desktop\Projects\Old Computer Projects\Laser Tag\Repository\laser-tag\laser-tag-v2>
This is my platformio.ini:
[env:d1]
platform = espressif8266
board = d1
framework = arduino
test_ignore = test_native
build_flags = -DEMBEDDED_BUILD
monitor_speed = 115200
lib_deps = google/googletest@^1.12.1
[env:native]
platform = native
lib_compat_mode = off
test_ignore = test_embedded
build_flags =
-std=c++17
lib_deps = google/googletest@^1.12.1
In project/test/test_native i have two files.
native_test.cpp:
#include <gtest/gtest.h>
int main(int argc, char** argv){
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
test_example.cpp:
#include <gtest/gtest.h>
TEST(example, test_if_returns_sum_of_two_given_ints){
ASSERT_EQ(3, 3);
}
- Windows 11