Skip to content

Feature Request: Add a Top-Level make test Target #2063

@rafaelvzago

Description

@rafaelvzago

Is your feature request related to a problem? Please describe.
Currently, there isn't a straightforward way to execute the tests located in the tests/ subdirectory directly from the top-level Makefile. Developers need to navigate into the tests/ directory and then run make to execute the test targets. This adds an extra step and can be inconvenient, especially when wanting to run tests frequently or as part of a larger build/test workflow from the project root.

Describe the solution you'd like
I would like to add a new target to the main Makefile that, when executed, navigates to the tests/ subdirectory and runs the targets defined within the tests/Makefile. Ideally, this new target would allow specifying which targets in the tests/Makefile to execute (e.g., make test-all, make test-unit). A default target could also be defined to run a standard set of tests.

Describe alternatives you've considered
One alternative is to always cd tests/ and run make from there. However, this requires the developer to manually change directories. Another alternative could be to copy the test targets into the main Makefile, but this would lead to duplication and make maintenance more difficult as the test logic evolves.

Additional context
This feature would improve the developer experience by providing a more convenient way to run tests. It would also make it easier to integrate test execution into automated build and CI/CD pipelines triggered from the project root. A possible implementation could involve using the -C flag of the make command to change the directory before executing the targets in the tests/Makefile. For example, a target named test in the main Makefile could be defined as:

test:
	$(MAKE) -C tests/

Or to run a specific target within the tests/Makefile:

e2e-tests:
	$(MAKE) -C tests/ unit

This approach leverages the existing Makefile within the tests/ directory and avoids duplicating any test definitions.

test-unit:
	$(MAKE) -C tests/ unit

This approach leverages the existing Makefile within the tests/ directory and avoids duplicating any test definitions.

Metadata

Metadata

Assignees

Labels

testIssue or activity associated with test development and operation

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions