Updated "Getting Started" documentation for GoogleTest

This commit is contained in:
Ivan Kravets
2022-06-26 14:47:25 +03:00
parent 1ea6d47110
commit b9a9fd4f43
4 changed files with 19 additions and 6 deletions

View File

@ -26,6 +26,7 @@ PlatformIO Core 6
* **Unit Testing**
- Updated "Getting Started" documentation for `GoogleTest <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/googletest.html>`__ testing and mocking framework
- Export |UNITTESTING| flags only to the project build environment (``projenv``, files in "src" folder)
- Merged the "building" stage with "uploading" for the embedded target (`issue #4307 <https://github.com/platformio/platformio-core/issues/4307>`_)
- Do not resolve dependencies from the project "src" folder when the `test_build_src <https://docs.platformio.org/en/latest//projectconf/section_env_test.html#test-build-src>`__ option is not enabled

2
docs

Submodule docs updated: 519b5db434...03cb09aa4c

View File

@ -13,6 +13,7 @@
# limitations under the License.
import os
import shutil
import sys
import xml.etree.ElementTree as ET
from pathlib import Path
@ -26,12 +27,16 @@ from platformio.test.cli import cli as pio_test_cmd
def test_calculator_example(tmp_path: Path):
junit_output_path = tmp_path / "junit.xml"
project_dir = tmp_path / "project"
shutil.copytree(
os.path.join("examples", "unit-testing", "calculator"), str(project_dir)
)
result = proc.exec_command(
[
"platformio",
"test",
"-d",
os.path.join("examples", "unit-testing", "calculator"),
str(project_dir),
"-e",
"uno",
"-e",
@ -67,11 +72,15 @@ def test_calculator_example(tmp_path: Path):
def test_list_tests(clirunner, validate_cliresult, tmp_path: Path):
json_output_path = tmp_path / "report.json"
project_dir = tmp_path / "project"
shutil.copytree(
os.path.join("examples", "unit-testing", "calculator"), str(project_dir)
)
result = clirunner.invoke(
pio_test_cmd,
[
"-d",
os.path.join("examples", "unit-testing", "calculator"),
str(project_dir),
"--list-tests",
"--json-output-path",
str(json_output_path),
@ -593,13 +602,16 @@ int main(int argc, char **argv)
def test_googletest_framework(clirunner, tmp_path: Path):
project_dir = os.path.join("examples", "unit-testing", "googletest")
project_dir = tmp_path / "project"
shutil.copytree(
os.path.join("examples", "unit-testing", "googletest"), str(project_dir)
)
junit_output_path = tmp_path / "junit.xml"
result = clirunner.invoke(
pio_test_cmd,
[
"-d",
project_dir,
str(project_dir),
"-e",
"native",
"--junit-output-path",