platformio / platformio/platformio-core

Please support multiple test_xxxx test cases in a single directory

Open
#4,641 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature unit testing
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to the
    PlatformIO IDE for VSCode repository

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Let's say I develop a library with 15 .cpp files. I place all the files in a single lib/x/src directory and everything is compact, simple, and easy to follow. Now I want to unit test these and platform requires that I should place each of the 15 test_xxxx.cpp in a separate directory. This has several drawbacks:

  1. Unnecessary complexity of the testing directory and burden to the users.
  2. No clear correlation between the production code structure and the test code structure.
  3. Difficult to tell which production files have a test and which ones are not.
  4. No clear place to put testing utilities that are shared by multiple tests.

Request: Please allow to have multiple test_xxxx.cpp files in test directories. When building a specific test, compile the relevant test_xxxx file and exclude the other ones. This will simplify to your users the process of writing tests and will improve the user experience.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing PlatformIO Core's test discovery and build entry points for test directories containing test_xxxx.cpp files, comparing them with the requested lib/x/src layout. Verify how a selected test is chosen and how other test_xxxx.cpp files are excluded. Done means multiple test files can share one directory while building only the selected test and preserving shared testing utilities.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
build-system, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.