Skip to content

Launch testing concept and guide page#1914

Draft
adityapande-1995 wants to merge 8 commits intorollingfrom
aditya/launch_testing
Draft

Launch testing concept and guide page#1914
adityapande-1995 wants to merge 8 commits intorollingfrom
aditya/launch_testing

Conversation

@adityapande-1995
Copy link
Copy Markdown
Contributor

@adityapande-1995 adityapande-1995 commented Sep 7, 2021

This PR aims to add a guide and launch page for launch_testing and improve the relevant documentation in general.

Status: In progress

TODO

  • Explain IOHandler objects, include example snippets
  • Expand section : Passing arguments to tests
  • Fix linting, whitespace issues

Main issue tracking the relevant PRs :

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Copy link
Copy Markdown
Member

@audrow audrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some early feedback. It will be good to have this information documented! Let me know if you have any questions on my suggestions.

Active Tests
------------

Any classes that inherit from ``unittest.TestCase`` and not decorated with the ``@post_shutdown_test`` descriptor will be run concurrently with the process under test.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Any classes that inherit from ``unittest.TestCase`` and not decorated with the ``@post_shutdown_test`` descriptor will be run concurrently with the process under test.
Any classes that inherit from ``unittest.TestCase`` and are not decorated with the ``@post_shutdown_test`` descriptor will be run concurrently with the process under test.

------------

Any classes that inherit from ``unittest.TestCase`` and not decorated with the ``@post_shutdown_test`` descriptor will be run concurrently with the process under test.
These tests are expected to interact with the running processes in some way. The tests inside a fixture (class) do not run in any specific order. For e.g, in the ``TestFixture_1`` class in the above template, it is not guaranteed that ``test_1`` will run before ``test_2`` or vice versa.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These tests are expected to interact with the running processes in some way. The tests inside a fixture (class) do not run in any specific order. For e.g, in the ``TestFixture_1`` class in the above template, it is not guaranteed that ``test_1`` will run before ``test_2`` or vice versa.
These tests are expected to interact with the running processes in some way. The tests inside a fixture (class) do not run in any specific order. For example, in the ``TestFixture_1`` class in the above template, it is not guaranteed that ``test_1`` will run before ``test_2`` or vice versa.

"e.g.," means "for example," so you wouldn't need the "for," however, I think it's better to just write the whole thing out. Typically, you see "e.g." in parentheses.

List of available assertions in ``launch_testing`` and their explanations can be found here. <TODO>
Most of the actions in ``launch.actions`` and ``launch_ros.actions`` can be used with launch testing. <TODO : Add links>

PYTHONUNBUFFERED environment variable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rather have a description of the effect of setting the variable in the title than the variable name. For example,

Suggested change
PYTHONUNBUFFERED environment variable
Reading stdout to console during testing


Context and handler objects
---------------------------
The ``launch_testing`` framework has a "context" dictionary that is passed to the test cases. The ``proc_info`` and ``proc_output`` members a added automatically by the framework so that the tests can access process output and exit codes.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``launch_testing`` framework has a "context" dictionary that is passed to the test cases. The ``proc_info`` and ``proc_output`` members a added automatically by the framework so that the tests can access process output and exit codes.
The ``launch_testing`` framework has a "context" dictionary that is passed to the test cases. The ``proc_info`` and ``proc_output`` members are added automatically by the framework so that the tests can access process output and exit codes.

* ``self.proc_info`` - a `ProcInfoHandler object <https://github.com/ros2/launch/blob/master/launch_testing/launch_testing/proc_info_handler.py>`__
* ``self.proc_output`` - an `IoHandler object <https://github.com/ros2/launch/blob/master/launch_testing/launch_testing/io_handler.py>`__

These objects provide dictionary like access to information about the running processes. They also contain methods that the active tests can use to wait for a process to exit or to wait for specific output.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
These objects provide dictionary like access to information about the running processes. They also contain methods that the active tests can use to wait for a process to exit or to wait for specific output.
These objects provide dictionary-like access to information about the running processes. They also contain methods that the active tests can use to wait for a process to exit or to wait for specific output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants