mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Updated "Getting Started" documentation for GoogleTest
This commit is contained in:
@ -26,6 +26,7 @@ PlatformIO Core 6
|
|||||||
|
|
||||||
* **Unit Testing**
|
* **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)
|
- 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>`_)
|
- 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
|
- 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
2
docs
Submodule docs updated: 519b5db434...03cb09aa4c
2
examples
2
examples
Submodule examples updated: 6c52fd3277...7376c6225b
@ -13,6 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from pathlib import Path
|
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):
|
def test_calculator_example(tmp_path: Path):
|
||||||
junit_output_path = tmp_path / "junit.xml"
|
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(
|
result = proc.exec_command(
|
||||||
[
|
[
|
||||||
"platformio",
|
"platformio",
|
||||||
"test",
|
"test",
|
||||||
"-d",
|
"-d",
|
||||||
os.path.join("examples", "unit-testing", "calculator"),
|
str(project_dir),
|
||||||
"-e",
|
"-e",
|
||||||
"uno",
|
"uno",
|
||||||
"-e",
|
"-e",
|
||||||
@ -67,11 +72,15 @@ def test_calculator_example(tmp_path: Path):
|
|||||||
|
|
||||||
def test_list_tests(clirunner, validate_cliresult, tmp_path: Path):
|
def test_list_tests(clirunner, validate_cliresult, tmp_path: Path):
|
||||||
json_output_path = tmp_path / "report.json"
|
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(
|
result = clirunner.invoke(
|
||||||
pio_test_cmd,
|
pio_test_cmd,
|
||||||
[
|
[
|
||||||
"-d",
|
"-d",
|
||||||
os.path.join("examples", "unit-testing", "calculator"),
|
str(project_dir),
|
||||||
"--list-tests",
|
"--list-tests",
|
||||||
"--json-output-path",
|
"--json-output-path",
|
||||||
str(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):
|
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"
|
junit_output_path = tmp_path / "junit.xml"
|
||||||
result = clirunner.invoke(
|
result = clirunner.invoke(
|
||||||
pio_test_cmd,
|
pio_test_cmd,
|
||||||
[
|
[
|
||||||
"-d",
|
"-d",
|
||||||
project_dir,
|
str(project_dir),
|
||||||
"-e",
|
"-e",
|
||||||
"native",
|
"native",
|
||||||
"--junit-output-path",
|
"--junit-output-path",
|
||||||
|
Reference in New Issue
Block a user