Dynamic functions

Sphinx-Test-Reports provides dynamic functions for Sphinx-Needs.

Read chapter Dynamic function from Sphinx-Needs documentation to know how to use them.

Links a need (e.g testcase) automatically to other needs, which have a specific value in a given option.


.. test-case:: My test case
   :id: TESTCASE_1
   :file: my_test_file.xml
   :suite: pytest
   :classname: sphinxcontrib.test_reports.test_reports
   :case: FLAKE8
   :links: [[tr_link("source_option", "target_option")]]

tr_link needs the following arguments:

  • source_option: Name of an option of the test-need, which is used for comparision. E.g. classname.

  • target_option: Name of an option of all other needs, which is used for comparision. E.g. title.

The function reads the target_option from the need, where it is used. Then it goes through all other needs and checks if the value of their source_option is equal to the target_option. If this is the case, their IDs get stored and finally returned.


.. spec:: sphinxcontrib.test_reports.test_reports
   :id: TESTSPEC_001
   :status: open
   :tags: example, link_example

   This specification specifies the test case ``sphinxcontrib.test_reports.test_reports``.

.. test-case:: Flake8 test case
   :id: TESTLINK_1
   :file: ../tests/doc_test/utils/pytest_data.xml
   :suite: pytest
   :classname: sphinxcontrib.test_reports.test_reports
   :case: FLAKE8
   :tags: example, link_example
   :links: [[tr_link('classname', 'title')]]

   A simple test case.
   We will set a link to the need, which has our classname as title.

.. needflow::
   :tags: link_example
Specification: sphinxcontrib.test_reports.test_reports TESTSPEC_001 _images/arrow-right-circle.svg
status: open
tags: example, link_example
links incoming: TESTLINK_1

This specification specifies the test case sphinxcontrib.test_reports.test_reports.


' Nodes definition 

node "<size:12>Specification</size>\n**sphinxcontrib.t**\n**est_reports.tes**\n**t_reports**\n<size:10>TESTSPEC_001</size>" as TESTSPEC_001 [[../functions.html#TESTSPEC_001]] #FEDCD2
rectangle "<size:12>Test-Case</size>\n**Flake8 test**\n**case**\n<size:10>TESTLINK_1</size>" as TESTLINK_1 [[../functions.html#TESTLINK_1]] #999999

' Connection definition