Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add document for testing with seastar #2407

Closed
wants to merge 1 commit into from

Conversation

tchaikov
Copy link
Contributor

since Boost.Test does not provide builtin support for testing test cases implemented with coroutine. we have our own test runner and macros for declaring tests. for new developers these macros and the macros like BOOST_AUTO_TEST_CASE could be confusing.

this document intend to clarify the declaration and organization of tests in Seastar and Seastar applications using Seastar's testing framework.

@tchaikov tchaikov requested a review from lersek August 27, 2024 02:10
doc/testing.md Outdated
@@ -0,0 +1,51 @@
# Testing

Seastar leverages Boost.Test and provides facilitiets for developers to implement tests in coroutines.
Copy link
Member

Choose a reason for hiding this comment

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

I suggest running aspell check on this file; here: s/facilitiets/facilities/.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, Benny suggested the similar before. =( i will try M-x flyspell-buffer next time.

doc/testing.md Outdated

Seastar leverages Boost.Test and provides facilitiets for developers to implement tests in coroutines.

## Tests Declaration
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather write Test Declarations or Declaring Tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'd go with "Test Declarations" to be more consistent with the titles of the same level.

doc/testing.md Outdated

* Boost.Test Native: Tests defined using `BOOST_AUTO_TEST_CASE` and related macros from Boost.Test. For more information, see the [Boost Test documentation](https://www.boost.org/doc/libs/release/libs/test/doc/html/boost_test/utf_reference/test_org_reference.html).
* Coroutine: Tests defined using `SEASTAR_TEST_CASE`. The test body returns a future, allowing implementation as a coroutine.
* Coroutine with `seastar::thread`: Tests defined using `SEASTAR_THREAD_TEST_CASE`. The test body is launched in a Seastar thread, allowing the use of Seastar coroutines. These tests should return `void`.
Copy link
Member

Choose a reason for hiding this comment

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

The link to the Boost.Test documentation is helpful; can we do the same with the other two kinds of tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. added the hyper links.

doc/testing.md Outdated
* For Seastar facilities that don't depend on coroutines, consider using `BOOST_AUTO_TEST_CASE`.


## Tests organization
Copy link
Member

Choose a reason for hiding this comment

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

Tests' Organization or Organizing Tests look more correct IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i picked the former.

doc/testing.md Outdated

## Tests organization

* Tests defined with `BOOST_AUTO_TEST_CASE` are driven by Boost.Test's built-in test runner. They require defining `BOOST_TEST_MODULE` to include the runner in the executable. These tests support additional features like fixtures and data-driven testing.
Copy link
Member

Choose a reason for hiding this comment

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

Might want to mention that the replacement list for the BOOST_TEST_MODULE macro is supposed to be the "name of the master test suite".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am adding a hyper link to Boost.Test's document. it should do a better job than i do in this regard.

since Boost.Test does not provide builtin support for testing
test cases implemented with coroutine. we have our own test runner
and macros for declaring tests. for new developers these macros
and the macros like `BOOST_AUTO_TEST_CASE` could be confusing.

this document intend to clarify the declaration and organization
of tests in Seastar and Seastar applications using Seastar's testing
framework.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov
Copy link
Contributor Author

v2:

  • fixed the misspelling of "facilitiets"
  • s/Tests Declaration/Test Declarations/
  • added hyperlinks for "coroutine" and "seastar::thread"
  • added hyperlink for "BOOST_TEST_MODULE"

@tchaikov tchaikov requested a review from lersek August 27, 2024 13:01
Copy link
Member

@lersek lersek left a comment

Choose a reason for hiding this comment

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

Thanks for putting up with my hair-splitting; looks great!

@xemul xemul closed this in f03f7df Aug 30, 2024
@tchaikov tchaikov deleted the doc-testing branch August 30, 2024 12:00
niekbouman pushed a commit to niekbouman/seastar that referenced this pull request Sep 16, 2024
since Boost.Test does not provide builtin support for testing
test cases implemented with coroutine. we have our own test runner
and macros for declaring tests. for new developers these macros
and the macros like `BOOST_AUTO_TEST_CASE` could be confusing.

this document intend to clarify the declaration and organization
of tests in Seastar and Seastar applications using Seastar's testing
framework.

Signed-off-by: Kefu Chai <[email protected]>

Closes scylladb#2407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants