Skip to content

Add Requirements

The EmbedOps CLI uses the eo requirements command to connect a requirements document with the code and unit tests for your project. These associations can then be uploaded to the EmbedOps platform to track implementation and current status of tests that test a given requirement.

EmbedOps supports the StrictDoc Syntax. An example of a document written in this format is Zephyr's StrictDoc for System Requirements

Prerequisites

Required

  • Have an EmbedOps project registered on the EmbedOps Platform
  • Have the Dev Container setup to use git, with a user.name configured. This allows EmbedOps Platform to know who is syncing requirements

Optional

Testing Out Requirements

To simply test out this functionality, you can follow the HIL Quick Start and add requirements to that project using the examples in the steps below.

Steps

  1. Create a requirements doc

    Add a .sdoc requirements document in the root of the project. Example of a minimal document:

    requirements.sdoc
    [DOCUMENT]
    TITLE: nRF53 Demo Project Requirements
    [REQUIREMENT]
    UID: UI-101
    TITLE: Does the thingy
    

  2. Tag implementations

    In your project's source code, add a @implements comment as shown below with the appropriate UID at the start of a function to link the function to the requirement. One requirement can have multiple @implements: tags in the code.

    // @implements: UI-101
    void myfunc(){
        // ... implementation goes here ...
    

  3. OPTIONAL: Tag a test

    In your project's unit tests, add a @tests comment as shown below with the appropriate UID at the start of a unit test function, to link the function to the requirement. A pass or fail of this unit test will roll up to the requirement on the EmbedOps Platform. One requirement can have many associated tests.

    // @tests: UI-101
    void test_mytest(void){
        // ... test goes here ...
    

  4. View requirements relations

    The relation between the requirement, the implementation, and the tests can now be seen when using eo requirements list. Example output:

    eo requirements list
    
    Requirement                                             Implementations                                         Tests                                             
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------
    UI-101 - Does the thingy                                src/main.c:27                                           test/test_template.c:12                           
    

    Troubleshooting

    The implementation or test not showing up in the eo requirements list? Double check the comment with the tag is directly above the related function definition. So it should NOT look like this:

        // @implements: UI-101
    
        //more comments, spaces, random global variables...
    
        void myfunc(){
            // ... implementation goes here ...
    
    and NOT like this:
        // @implements: UI-101
        uint8_t
        myfunc(){
            // ... implementation goes here ...
            return 0;
    

  5. Sync the requirements with EmbedOps and view status

    eo requirements sync
    

    Troubleshooting

    You will need to be logged in to the EmbedOps Platform to sync with it. You can make sure you're logged in by running eo login first

    This will sync the current state of the requirements with the EmbedOps Platform. It can now be viewed under the project's repo "Requirements" section. The status will have a pass or fail depending on if the associated tests fail.

    Example screenshot of a pass and fail status on the Requirements page of the EmbedOps Platform

    You can check the current status of the requirements with the below eo command:

    eo requirement status
    

Next Steps

You can find out more about requirements by looking at the eo requirements Reference page