Skip to content
Ulrond edited this page Jul 17, 2024 · 24 revisions

ut-core is a modular unit testing framework designed to streamline and simplify the process of developing and executing tests within the RDK Central ecosystem. It provides a collection of tools, utilities, and conventions to help you build robust and reliable tests for your software components.

Key Features

  • Modular Design: ut-core is built with a modular architecture, allowing you to select and use the components that best suit your specific testing needs.
  • Flexible Test Definition: Define test cases and configurations using human-readable formats like YAML or JSON, making it easy to create and manage your tests.
  • Data-Driven Testing: Parameterize your tests with input data to cover a wide range of scenarios and edge cases.
  • Rich Assertion Library: Validate your test results using a comprehensive set of built-in assertions or create your own custom assertions.
  • Test Reporting: Generate detailed test reports to easily identify and diagnose issues.
  • Integration with CI/CD: Seamlessly integrate ut-core into your continuous integration and continuous delivery pipelines for automated testing.
  • Extensibility: Extend ut-core's functionality by developing custom modules or plugins.

Documentation Subpages

Here are some of the key modules within ut-core that you can explore in more detail:

ut-control

Control features have moved to a separate repo ut-control

(More subpages can be added here as you document additional ut-core modules)

Getting Started

  1. Installation: Follow the installation instructions in the ut-core repository to set up the framework in your development environment.
  2. Explore the Modules: Familiarize yourself with the different modules available in ut-core, each catering to specific testing needs.
  3. Define Your Tests: Use YAML or JSON to create test case definitions, input data, and expected results.
  4. Execute Your Tests: Run your tests using the ut-core test runner.
  5. Analyze Results: Review test reports to identify any failures or issues.

Running Tests

To execute your tests using the ut-core framework, the main argument features will be linked into your test. This executable provides various command-line switches to customize how your tests are run:

Example of the unit test

The unit tests are also a combined binary with ut-core, therefore it also has the switches.

./tests/bin/ut-test -h
Help
-a - Automated Mode
-b - Basic Mode
-f - <filename> - set the output filename for automated mode
-t - List all tests run to a file
-l - Set the log Path
-p - <profile_filename> - specify the profile to load YAML or JSON, also used by kvp_profile
-h - Help

Using the -p profile_filename switch

  • hdmiProfile.yml
hdmicec:
  config:
    extendedEnumsSupported: false
  • Passing a profile into the testing suite
./hdmi_cec -p hdmiProfile.yml

then in the testing code you would perform

bool extendedEnumsSupported = ut_kvp_getBoolField( ut_kvp_profile_getInstance(), ""hdmicec/config/extendedEnumsSupported" ); 
if ( extendedEnumsSupported == false )
{
   /* Complete suite is disabled due to supportExtendedEnums == false */
    pSuite = UT_add_suite("test extended functions ", NULL, NULL );

    UT_add_test(pSuite, "test extended bool", test_bool);
    UT_add_test(pSuite, "test extended string", test_string);
    UT_add_test(pSuite, "test extended uint32", test_uint32);
}

Contributing

We welcome contributions to ut-core! If you have ideas for new features, bug fixes, or improvements to the documentation, please open an issue or submit a pull request on our GitHub repository.

Let us know if you have any questions or feedback!

Clone this wiki locally