All Projects → tymonx → utest

tymonx / utest

Licence: BSD-3-Clause license
Lightweight unit testing framework for C/C++ projects. Suitable for embedded devices.

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects
shell
77523 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to utest

Sinon
Test spies, stubs and mocks for JavaScript.
Stars: ✭ 8,828 (+48944.44%)
Mutual labels:  unit-testing, tdd, test-driven-development
Awesome Unit Testing Swift
A curated collection of awesome blog articles, books, talks, podcasts, tools/frameworks and examples.
Stars: ✭ 272 (+1411.11%)
Mutual labels:  unit-testing, tdd, test-driven-development
cortexm-AES
high performance AES implementations optimized for cortex-m microcontrollers
Stars: ✭ 18 (+0%)
Mutual labels:  arm, microcontrollers, cortex-m
Bash unit
bash unit testing enterprise edition framework for professionals
Stars: ✭ 419 (+2227.78%)
Mutual labels:  unit-testing, tdd, test-driven-development
bleeding-edge-toolchain
All-in-one script to build bleeding-edge-toolchain for ARM microcontrollers
Stars: ✭ 60 (+233.33%)
Mutual labels:  arm, cortex-m, arm-microcontrollers
Quixote
CSS unit and integration testing
Stars: ✭ 788 (+4277.78%)
Mutual labels:  unit-testing, tdd, test-driven-development
Js Unit Testing Guide
📙 A guide to unit testing in Javascript
Stars: ✭ 1,346 (+7377.78%)
Mutual labels:  unit-testing, tdd
Fast Check
Property based testing framework for JavaScript (like QuickCheck) written in TypeScript
Stars: ✭ 2,604 (+14366.67%)
Mutual labels:  unit-testing, tdd
Transport Eta
Twitch streamed 🎥playground repo, README speaks to you.
Stars: ✭ 223 (+1138.89%)
Mutual labels:  unit-testing, tdd
stm32f103xx
DEPRECATED
Stars: ✭ 31 (+72.22%)
Mutual labels:  arm, cortex-m
Enzyme Matchers
Jasmine/Jest assertions for enzyme
Stars: ✭ 881 (+4794.44%)
Mutual labels:  unit-testing, tdd
Quiz App
A repository reflecting the progress made on the "How to Build iOS Apps with Swift, TDD & Clean Architecture" YouTube series, by Caio & Mike.
Stars: ✭ 230 (+1177.78%)
Mutual labels:  unit-testing, tdd
ez-rtos
A micro real-time operating system supporting task switching, delay function, memory allocator and critical section. It is writen on ARM Cortex-M3 assemble language, it runs successfully on STM32F103 MCU.
Stars: ✭ 57 (+216.67%)
Mutual labels:  arm, cortex-m
Autoparams
Arbitrary test data generator for parameterized tests in Java inspired by AutoFixture.
Stars: ✭ 77 (+327.78%)
Mutual labels:  unit-testing, tdd
Fluentassertions
A very extensive set of extension methods that allow you to more naturally specify the expected outcome of a TDD or BDD-style unit tests. Targets .NET Framework 4.7, .NET Core 2.1 and 3.0, as well as .NET Standard 2.0 and 2.1. Supports the unit test frameworks MSTest2, NUnit3, XUnit2, MSpec, and NSpec3.
Stars: ✭ 2,449 (+13505.56%)
Mutual labels:  unit-testing, tdd
Qtools
QTools collection of open source tools for embedded systems development on Windows, Linux and MacOS
Stars: ✭ 64 (+255.56%)
Mutual labels:  unit-testing, arm
Alsatian
TypeScript testing framework with test cases
Stars: ✭ 244 (+1255.56%)
Mutual labels:  unit-testing, tdd
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+127.78%)
Mutual labels:  unit-testing, test-driven-development
alloc-cortex-m
A heap allocator for Cortex-M processors
Stars: ✭ 139 (+672.22%)
Mutual labels:  arm, cortex-m
doctest
The fastest feature-rich C++11/14/17/20 single-header testing framework
Stars: ✭ 4,434 (+24533.33%)
Mutual labels:  unit-testing, tdd

µTest

Language Standard License (3-Clause BSD) Build Status Coverity Scan Build Status Coverage Status Join the chat at https://gitter.im/utest-embedded/Lobby

Lightweight unit testing framework mainly for C++ and also for C projects. Suitable for embedded devices.

Key Features

  • Written in C++11
  • An XUnit test framework
  • The 3-clause BSD license
  • No evil defined test macros, programmer API style
  • Detailed assert messages including type info, address and total size in bytes
  • Automatic test registration
  • Single registered test can have multi test suites and test cases
  • A rich set of assertions
  • Fatal and non-fatal assertions
  • Support for multi reporters with multi writers
  • Working with/without exceptions and RTTI
  • Optionally running test case in isolate environment using thread
  • Minimal virtual methods usage
  • Small footprint, friendly for embedded target like Cortex-Mx microcontrollers
  • Warnings free even on the most aggressive levels
  • Support for Clang 3.5 and later
  • Support for GCC 4.8 and later

How to use it

Examples

Test source example:

#include <utest/utest.hpp>

using namespace utest;

static unsigned int Factorial(unsigned int number) {
    return number > 1 ? Factorial(number - 1) * number : 1;
}

static TestRunner g([] (TestSuite& test_suite) {
    test_suite.name("Factorial").run([] (TestCase& test_case) {
        test_case.name("computed").run([] (TestParams& p) {
            TestAssert{p}.equal(Factorial(0), 1u);
            TestAssert{p}.equal(Factorial(1), 1u);
            TestAssert{p}.equal(Factorial(2), 2u);
            TestAssert{p}.equal(Factorial(3), 6u);
            TestAssert{p}.equal(Factorial(10), 3628800u);
        });
    });
});

Test output example:

[==========] Running 1 registered test runner(s).
[----------] Running test(s) from Factorial
[ RUN      ] computed
[       OK ] computed
[----------] 1 test(s) from Factorial
[  PASSED  ] 1 test(s).

[==========] 1 test(s) from 1 test suite(s) ran.
[  PASSED  ] 1 test(s).

Test assert message examples:

unit_test.cpp:7: Failure
Expected: (boolean)[address=0x00007fa3b3411e08,size=1] is true
  Actual: false

unit_test.cpp:13: Failure
Expected: (string)[address=0x00007fff4d0c00b0,size=4] == (string)[address=0x00000000004097ee,size=5]
  Actual: "Text" == "TextB"

unit_test.cpp:17: Failure
Expected: (signed int)[address=0x00007fa3b3411dc8,size=4] == (signed int)[address=0x00007fa3b3411d98,size=4]
  Actual: 1 == 2

Main example with multi writers:

#include <utest/utest.hpp>

#include <utest/test_writer/udp.hpp>
#include <utest/test_writer/file.hpp>
#include <utest/test_reporter/google_test.hpp>

#include <cstdlib>

using namespace utest;

int main(int argc, char* argv[]) {
    test_writer::UDP udp{"127.0.0.1", 51234};
    test_writer::File out{stdout};

    TestWriterRefence writers[]{
        out,
        udp
    };

    test_reporter::GoogleTest google_test{writers};

    TestReporterReference reporters[]{
        google_test
    };

    return TestStatus::PASS == Test{argc, argv}.run().status()
        ? EXIT_SUCCESS : EXIT_FAILURE;
}

Test example with evil macros extension:

#include <utest/utest.hpp>
#include <utest/test_extension/evil_defines.hpp>

UTEST_RUNNER()
    UTEST_SUITE("integer compare")
        int x = 0;

        UTEST_CASE_CONTEXT(x);

        UTEST_CASE_SETUP()
            UTEST_CONTEXT(int) = 5;
        UTEST_CASE_SETUP_END

        UTEST_CASE("equal")
            UTEST_EXPECT_EQ(UTEST_CONTEXT(int), 5);
        UTEST_CASE_END

        UTEST_CASE_SETUP()
            UTEST_CONTEXT(int) = 4;
        UTEST_CASE_SETUP_END

        UTEST_CASE("not equal")
            UTEST_EXPECT_NE(UTEST_CONTEXT(int), 5);
        UTEST_CASE_END
    UTEST_SUITE_END
UTEST_RUNNER_END
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].