Skip to content

Conversation

@furtib
Copy link
Contributor

@furtib furtib commented Aug 15, 2025

Why:
We have no rigid guidelines or utilities for our testing needs.

What:

  • Created a README.md detailing how to run and extend our test suite.
  • Created a common library to provide utility for new tests.
    • The common lib contains the TestBase class with a few modifications:
      • The check_command has been renamed to run_command; it no longer asserts anything, it returns the exit code, and the stdout and stderr in a tuple
      • The global variables for the BAZEL_BIN_DIR and BAZEL_TESTLOGS_DIR have been moved into the class as data. They must be set by the test class.
      • A new variable __test_path__ have been introduced; this is necessary so execution always happens in the specific tests directory.
  • Added a template test, so new tests can be started with just a cp -r template/ new_test/

Addresses:
#22

@furtib furtib requested a review from Szelethus August 15, 2025 09:12
@furtib furtib self-assigned this Aug 15, 2025
@furtib furtib added the enhancement New feature or request label Aug 15, 2025
This was referenced Aug 15, 2025
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move setup_logging here as well?

@furtib furtib requested a review from Szelethus August 15, 2025 12:17
@furtib furtib marked this pull request as draft August 15, 2025 15:04
@furtib
Copy link
Contributor Author

furtib commented Aug 15, 2025

We are learning by trial; this patch is not ready yet.

@furtib furtib marked this pull request as ready for review August 18, 2025 07:20
@furtib furtib force-pushed the common_lib_for_unit_tests branch from 8bb540d to 2794f4f Compare August 18, 2025 12:48
@furtib furtib changed the title Create common lib Test infra structure definiton Aug 19, 2025
@furtib furtib requested a review from Szelethus August 19, 2025 12:32
@Szelethus Szelethus changed the title Test infra structure definiton Test infrastructure structure definiton Aug 19, 2025
@Szelethus Szelethus changed the title Test infrastructure structure definiton Test infrastructure definiton Aug 19, 2025
@furtib furtib force-pushed the common_lib_for_unit_tests branch from 45d1c13 to 217dc53 Compare August 19, 2025 13:06
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took a while, thank you so much for the patience! LGTM! I'm sure we'll find some issues later down the line as we put this base class to the test (haha), but lets move on now.

@Szelethus Szelethus linked an issue Aug 21, 2025 that may be closed by this pull request
Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets send it.

@Szelethus Szelethus merged commit 5086601 into Ericsson:main Aug 21, 2025
2 checks passed
furtib added a commit to furtib/codechecker_bazel that referenced this pull request Aug 27, 2025
Why:
We have no rigid guidelines or utilities for our testing needs.

What:
- Created a README.md detailing how to run and extend our test suite.
- Created a common library to provide utility for new tests.
- The common lib contains the TestBase class with a few modifications:
- The check_command has been renamed to run_command; it no longer
asserts anything, it returns the exit code, and the stdout and stderr in
a tuple
- The global variables for the BAZEL_BIN_DIR and BAZEL_TESTLOGS_DIR have
been moved into the class as data. They must be set by the test class.
- A new variable \_\_test_path\_\_ have been introduced; this is
necessary so execution always happens in the specific tests directory.
- Added a template test, so new tests can be started with just a `cp -r
template/ new_test/`

Addresses:
Ericsson#22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define directory structure for tests

3 participants