.. _omni.graph.test:

OmniGraph Integration Testing
#############################

.. tabularcolumns:: |L|R|

.. csv-table::
   :width: 100%

   **Extension**: omni.graph.test,**Documentation Generated**: |today|

In order to effectively test the OmniGraph access to nodes and scripts that are not necessary for the graph
to operate correctly. In order to minimize the unnecessary files, yet still have nodes and files explicitly for
testing, all of that functionality has been broken out into this extension.

Dependencies
============
As the purpose of this extension is to provide testing facilities for all of OmniGraph it will have load
dependencies on all of the `omni.graph.*` extensions. If any new ones are added they should be added to
the dependencies in the file ``config/extension.toml``.

Data Files
==========
Three types of data files are accessed in this extension:

1. Generic data files, created in other extensions for use by the user (e.g. compound node definitions)
2. Example files, created to illustrate how to use certain nodes but not intended for general use
3. Test files, used only for the purpose of loading to test certain features

The ``data/`` subdirectories in this extension contains the latter of those three. The other files live in the
lowest level extension in which they are legal (e.g. if they contain a node from `omni.graph.nodes` then
they will live in that extension). As this extension has dependencies on all of the OmniGraph extensions it will
have access to all of their data files as well.

Node Files
==========
Most nodes will come from other extensions. Some nodes are created explicitly for testing purposes. These will appear
in this extension and should not be used for any other purpose.

Import Example
--------------
This simple example shows how the test files from the `omni.graph.examples.python` extension were imported and
enabled in this extension.

The first step was to move the required files into the directory tree:

.. code-block:: text

    omni.graph.test/
    ├── python/
        └── tests/
            ├──── test_omnigraph_simple.py
            └── data/
                ├──── TestEventTrigger.usda
                └──── TestExecutionConnections.usda

.. note::

    The two .usda files contain only nodes from the `omni.graph.examples.python` extension and are solely used
    for test purposes. That is why they could be moved into the extension's test directory.

Next the standard automatic test detection file was added to ``omni.graph.test/python/tests/__init__.py``

.. literalinclude:: ../python/tests/__init__.py
    :linenos:
    :language: python

Finally, the `config/extension.toml` had additions made to inform it of the dependency on the new extension:

.. literalinclude:: ../config/extension.toml
    :language: toml
    :linenos:
    :emphasize-lines: 34


.. toctree::
   :maxdepth: 1

   CHANGELOG