mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Optimize unit testing report CLI
This commit is contained in:
@ -57,7 +57,7 @@ Please check `Migration guide from 5.x to 6.0 <https://docs.platformio.org/en/la
|
||||
- Added support for a `custom Unity library <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/examples/custom_unity_library.html>`__ (`issue #3980 <https://github.com/platformio/platformio-core/issues/3980>`_)
|
||||
- Added support for the ``socket://`` and ``rfc2217://`` protocols using `test_port <https://docs.platformio.org/en/latest/projectconf/section_env_test.html#test-port>`__ option (`issue #4229 <https://github.com/platformio/platformio-core/issues/4229>`_)
|
||||
- Pass extra arguments to the testing program with a new `pio test --program-arg <https://docs.platformio.org/en/latest/core/userguide/cmd_test.html#cmdoption-pio-test-a>`__ option (`issue #3132 <https://github.com/platformio/platformio-core/issues/3132>`_)
|
||||
- Generate reports in JUnit and JSON formats using the `pio test --output-format <https://docs.platformio.org/en/latest/core/userguide/cmd_test.html#cmdoption-pio-test-output-format>`__ option (`issue #2891 <https://github.com/platformio/platformio-core/issues/2891>`_)
|
||||
- Generate reports in JUnit and JSON formats using the `pio test <https://docs.platformio.org/en/latest/core/userguide/cmd_test.html>`__ command (`issue #2891 <https://github.com/platformio/platformio-core/issues/2891>`_)
|
||||
- Provide more information when the native program crashed on a host (errored with a negative return code) (`issue #3429 <https://github.com/platformio/platformio-core/issues/3429>`_)
|
||||
- Fixed an issue when command line parameters (``--ignore``, ``--filter``) do not override values defined in the |PIOCONF| (`issue #3845 <https://github.com/platformio/platformio-core/issues/3845>`_)
|
||||
- Renamed the "test_build_project_src" project configuration option to the `test_build_src <https://docs.platformio.org/en/latest//projectconf/section_env_test.html#test-build-src>`__
|
||||
|
2
docs
2
docs
Submodule docs updated: db1960e263...41042eb9fd
@ -83,12 +83,8 @@ from platformio.test.runners.factory import TestRunnerFactory
|
||||
multiple=True,
|
||||
help="A program argument (multiple are allowed)",
|
||||
)
|
||||
@click.option("--output-format", type=click.Choice(["json", "junit"]))
|
||||
@click.option(
|
||||
"--output-path",
|
||||
default=os.getcwd,
|
||||
type=click.Path(dir_okay=True, resolve_path=True),
|
||||
)
|
||||
@click.option("--output-json", type=click.Path(resolve_path=True))
|
||||
@click.option("--output-junit", type=click.Path(resolve_path=True))
|
||||
@click.option("--verbose", "-v", is_flag=True)
|
||||
@click.pass_context
|
||||
def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
|
||||
@ -107,8 +103,8 @@ def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-bu
|
||||
monitor_rts,
|
||||
monitor_dtr,
|
||||
program_args,
|
||||
output_format,
|
||||
output_path,
|
||||
output_json,
|
||||
output_junit,
|
||||
verbose,
|
||||
):
|
||||
app.set_session_var("custom_project_conf", project_conf)
|
||||
@ -181,7 +177,9 @@ def test_cmd( # pylint: disable=too-many-arguments,too-many-locals,redefined-bu
|
||||
stdout_report = TestReportFactory.new("stdout", test_result)
|
||||
stdout_report.generate(verbose=verbose)
|
||||
|
||||
if output_format:
|
||||
for output_format, output_path in [("json", output_json), ("junit", output_junit)]:
|
||||
if not output_path:
|
||||
continue
|
||||
custom_report = TestReportFactory.new(output_format, test_result)
|
||||
custom_report.generate(output_path=output_path, verbose=True)
|
||||
|
||||
|
@ -36,8 +36,7 @@ def test_calculator_example(tmp_path: Path):
|
||||
"uno",
|
||||
"-e",
|
||||
"native",
|
||||
"--output-format=junit",
|
||||
"--output-path",
|
||||
"--output-junit",
|
||||
str(junit_output_path),
|
||||
]
|
||||
)
|
||||
@ -527,8 +526,7 @@ int main(int argc, char **argv)
|
||||
[
|
||||
"-d",
|
||||
str(project_dir),
|
||||
"--output-format=junit",
|
||||
"--output-path",
|
||||
"--output-junit",
|
||||
str(junit_output_path),
|
||||
],
|
||||
)
|
||||
@ -553,8 +551,7 @@ int main(int argc, char **argv)
|
||||
[
|
||||
"-d",
|
||||
str(project_dir),
|
||||
"--output-format=json",
|
||||
"--output-path",
|
||||
"--output-json",
|
||||
str(json_output_path),
|
||||
"-a",
|
||||
"-aa=1", # fail after the 1 error
|
||||
@ -578,8 +575,7 @@ def test_googletest_framework(clirunner, tmp_path: Path):
|
||||
project_dir,
|
||||
"-e",
|
||||
"native",
|
||||
"--output-format=junit",
|
||||
"--output-path",
|
||||
"--output-junit",
|
||||
str(junit_output_path),
|
||||
],
|
||||
)
|
||||
@ -606,8 +602,7 @@ def test_googletest_framework(clirunner, tmp_path: Path):
|
||||
project_dir,
|
||||
"-e",
|
||||
"native",
|
||||
"--output-format=json",
|
||||
"--output-path",
|
||||
"--output-json",
|
||||
str(json_output_path),
|
||||
"-a",
|
||||
"--gtest_filter=-FooTest.Bar",
|
||||
|
Reference in New Issue
Block a user