How to include keyword documentation in robot.testdoc generated HTML

Hi,

We’re currently using robot.testdoc to generate documentation from our Robot Framework test case file, but it doesn’t include keyword documentation. We would like to include the documentation for the keywords used in the test cases in the generated output as well.

Could anyone suggest how we can achieve this?

Thanks in advance for your help!

Example of the Test Case File:

*** Settings ***
Documentation    Test suite Sample

Suite Setup         Suite Pre Conditions
Suite Teardown      Suite Post Conditions

*** Variables ***

*** Keywords ***
Suite Pre Conditions
    [Documentation]     Pre steps  
    Log    Pre steps

Suite Post Conditions
    [Documentation]     Post steps 
    Log    Post steps

Create Test File 
    [Documentation]     Create Test File  
    Log    Create Test File

Update Test File
    [Documentation]     Update Test File
    Log    Update Test File

Delete Test File
    [Documentation]     Delete Test File
    Log    Delete Test File

*** Test Cases ***
Verify Backup and Restore
    [Documentation]    To verify file creation, update, and deletion
    [Tags]             tc1

    Create Test File
    Update Test File
    Delete Test File

HTML

If you are looking to have the documentation for the tests and the keywords in the same file, I’m not sure how or if you could do that.

In case you are not already aware, keyword documentation can be generated with libdoc.

So you could generate two documentation files for the file you are interested in, but that still only leaves you with keyword documentation for keywords defined in that particular file, whereas your test may be using other keywords as well.

P.S. If the main purpose of generating documentation is to aid test development, then you may want to look at what your IDE can do for you. Ex. the RobotCode extension for VS Code has a keywords section in the explorer tab. Tapping the book icon next to a library opens up the html documentation that libdoc generates.

Hi Silken,

Thank you for your response.

Yes, I’m looking for documentation that includes both test and keywords in the same.
This is to make it easier to share testcase details with peers during reviews, particularly for those who prefer not to view robot files directly.

I’m already aware of libdoc.