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

add TESTING.md #281

Merged
merged 1 commit into from
Oct 11, 2024
Merged

add TESTING.md #281

merged 1 commit into from
Oct 11, 2024

Conversation

poneill
Copy link
Contributor

@poneill poneill commented Sep 29, 2023

Add document describing general testing philosophy and tactical considerations for writing effective unit tests.

Summary by CodeRabbit

  • Documentation
    • Introduced a comprehensive section on testing in the TESTING.md file, highlighting the importance of software testing for reliability in scientific and clinical research.
    • Provided guidelines for writing effective tests, including the "Beyonce Rule" and considerations for unit tests.
    • Discussed the significance of code coverage and offered specific advice for unit testing in Python with pytest.

@cristinaetrv
Copy link
Collaborator

Notes from discussion about TESTING.md:

  • Add language about manual testing
  • Amendment for other languages (besides python)
  • Examples of good/bad tests

@austinTalbot7241993 austinTalbot7241993 marked this pull request as ready for review October 8, 2024 12:39
Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

The changes made to the TESTING.md file for the Bystro project introduce a detailed section on the significance of software testing in scientific and clinical research applications. The section covers the necessity of automated testing, psychological barriers to effective testing, guidelines for writing tests, and considerations for unit tests. It also discusses code coverage and provides specific advice for using the pytest framework in Python. No alterations were made to the declarations of exported or public entities.

Changes

File Change Summary
TESTING.md Added a comprehensive section on the importance of testing, guidelines for writing tests, and advice for unit testing in Python with pytest. Discussed psychological barriers to testing and the concept of code coverage.

Poem

In the land of code where rabbits hop,
Testing is key, we can't let it stop!
With guidelines and rules, we’ll leap with glee,
Ensuring our software is bug-free, you see!
So let’s write our tests, both fast and bright,
For a future of coding that feels just right! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (4)
TESTING.md (4)

3-19: LGTM! Minor suggestion for improvement.

The background section effectively establishes the importance of testing in the context of scientific and clinical research. It provides a comprehensive list of benefits derived from software testing, which is valuable for setting the tone of the document.

Consider adding a comma after "in general" on line 7 for improved readability:

-While there is in general no silver
+While there is, in general, no silver
🧰 Tools
🪛 LanguageTool

[typographical] ~7-~7: Consider isolating this adverbial phrase with commas.
Context: ...nces of its correctness. While there is in general no silver bullet for assuring the corre...

(IN_FACT_COMMA_2)


[uncategorized] ~9-~9: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...complex programs, software testing is a widely-adopted strategy for increasing software reliab...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


20-63: Excellent section on psychological aspects. Minor wording suggestion.

This section effectively addresses the psychological barriers to testing and illustrates the contrasting states of codebases with low and high test coverage. It provides valuable insights into the benefits of maintaining a well-tested codebase.

Consider removing the duplication of "Testing" on line 20:

-## Psychological Barriers to Effective Testing
-Testing is often perceived to be a laborious chore, a consideration
+## Psychological Barriers to Effective Testing
+Testing is often perceived as a laborious chore, a consideration
🧰 Tools
🪛 LanguageTool

[duplication] ~20-~20: Possible typo: you repeated a word
Context: ... ## Psychological Barriers to Effective Testing Testing is often perceived to be a laborious ch...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~34-~34: This phrase is redundant. Consider using “outside”.
Context: ...er module within Bystro, or a library outside of Bystro entirely. - Software, like any c...

(OUTSIDE_OF)


86-103: Balanced perspective on code coverage. Minor grammatical suggestion.

This section provides a nuanced view of code coverage, effectively communicating its benefits while warning against over-reliance on coverage metrics. The discussion on the limitations of code coverage as a measure of test quality is particularly valuable.

Consider adding a comma after "however" on line 93 for improved readability:

-That, however is no
+That, however, is no
🧰 Tools
🪛 LanguageTool

[style] ~88-~88: Consider a shorter alternative to avoid wordiness.
Context: ...code in a module executed during tests, in order to set standards for testing. There is a ...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~93-~93: Possible missing comma found.
Context: ...better than no assurance at all. That, however is no guarantee that the tests effectiv...

(AI_HYDRA_LEO_MISSING_COMMA)


1-148: Excellent introduction to testing practices. Consider addressing additional points.

This TESTING.md document provides a comprehensive and well-structured guide to testing practices for the Bystro project. It effectively covers the psychological aspects of testing, practical considerations for writing tests, and specific advice for unit testing in Python.

The document successfully addresses the main PR objective of introducing a general testing philosophy and providing tactical considerations for writing effective unit tests. However, to fully address the comments from the PR discussion, consider the following additions:

  1. Include a section on the importance and role of manual testing alongside automated unit tests.
  2. Expand the document to cover testing considerations for programming languages other than Python, making it more broadly applicable to the entire project.
  3. Add examples of good and bad unit tests to illustrate best practices and common pitfalls.

These additions would further enhance the document's value as a comprehensive testing resource for the project.

Would you like assistance in drafting sections to address these additional points?

🧰 Tools
🪛 LanguageTool

[typographical] ~7-~7: Consider isolating this adverbial phrase with commas.
Context: ...nces of its correctness. While there is in general no silver bullet for assuring the corre...

(IN_FACT_COMMA_2)


[uncategorized] ~9-~9: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...complex programs, software testing is a widely-adopted strategy for increasing software reliab...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[duplication] ~20-~20: Possible typo: you repeated a word
Context: ... ## Psychological Barriers to Effective Testing Testing is often perceived to be a laborious ch...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~34-~34: This phrase is redundant. Consider using “outside”.
Context: ...er module within Bystro, or a library outside of Bystro entirely. - Software, like any c...

(OUTSIDE_OF)


[style] ~88-~88: Consider a shorter alternative to avoid wordiness.
Context: ...code in a module executed during tests, in order to set standards for testing. There is a ...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~93-~93: Possible missing comma found.
Context: ...better than no assurance at all. That, however is no guarantee that the tests effectiv...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~125-~125: Consider a shorter alternative to avoid wordiness.
Context: ...world or doing more work than necessary in order to verify the property under test. If a t...

(IN_ORDER_TO_PREMIUM)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6450aef and d5b98ed.

📒 Files selected for processing (1)
  • TESTING.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
TESTING.md

[typographical] ~7-~7: Consider isolating this adverbial phrase with commas.
Context: ...nces of its correctness. While there is in general no silver bullet for assuring the corre...

(IN_FACT_COMMA_2)


[uncategorized] ~9-~9: Although a hyphen is possible, it is not necessary in a compound modifier in which the first word is an adverb that ends in ‘ly’.
Context: ...complex programs, software testing is a widely-adopted strategy for increasing software reliab...

(HYPHENATED_LY_ADVERB_ADJECTIVE)


[duplication] ~20-~20: Possible typo: you repeated a word
Context: ... ## Psychological Barriers to Effective Testing Testing is often perceived to be a laborious ch...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~34-~34: This phrase is redundant. Consider using “outside”.
Context: ...er module within Bystro, or a library outside of Bystro entirely. - Software, like any c...

(OUTSIDE_OF)


[style] ~88-~88: Consider a shorter alternative to avoid wordiness.
Context: ...code in a module executed during tests, in order to set standards for testing. There is a ...

(IN_ORDER_TO_PREMIUM)


[uncategorized] ~93-~93: Possible missing comma found.
Context: ...better than no assurance at all. That, however is no guarantee that the tests effectiv...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~125-~125: Consider a shorter alternative to avoid wordiness.
Context: ...world or doing more work than necessary in order to verify the property under test. If a t...

(IN_ORDER_TO_PREMIUM)

🔇 Additional comments (3)
TESTING.md (3)

66-85: Well-structured guidelines for writing tests.

This section provides clear and practical guidance on how to approach writing tests. The introduction of the "Beyonce Rule" offers a memorable principle for deciding what to test. The general considerations for unit tests are concise and highly relevant, emphasizing the importance of self-contained, deterministic, and fast tests.


106-141: Practical guidance for unit testing in Python.

This section provides valuable, project-specific advice on unit testing using pytest. The discussion on handling slow tests is particularly useful, offering both strategies for optimization and practical solutions like test marking. The inclusion of a code example for marking slow tests enhances the clarity of the guidance.

🧰 Tools
🪛 LanguageTool

[style] ~125-~125: Consider a shorter alternative to avoid wordiness.
Context: ...world or doing more work than necessary in order to verify the property under test. If a t...

(IN_ORDER_TO_PREMIUM)


143-148: Properly formatted footnote.

The footnote is correctly formatted and provides a relevant reference to "Software Engineering at Google: Testing". This adds credibility to the document and offers readers a valuable resource for further reading.

@akotlar akotlar merged commit 33aacdc into bystrogenomics:master Oct 11, 2024
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.

4 participants