Skip to content

Add ability to run only the unit tests#237

Merged
lawrence-forooghian merged 1 commit intomainfrom
add-ability-to-run-unit-tests
Mar 13, 2025
Merged

Add ability to run only the unit tests#237
lawrence-forooghian merged 1 commit intomainfrom
add-ability-to-run-unit-tests

Conversation

@lawrence-forooghian
Copy link
Copy Markdown
Collaborator

@lawrence-forooghian lawrence-forooghian commented Mar 13, 2025

This excludes the long-running integration test. Useful for quick feedback when developing, and also for quickly checking that we haven't accidentally introduced a long-running unit test.

Summary by CodeRabbit

  • New Features

    • Introduced new scheme files for AblyChat and BuildTool, enhancing build and testing workflows.
    • Added new test plans for comprehensive and unit testing, allowing for tailored test execution.
  • Tests

    • Implemented distinct test plans to differentiate comprehensive tests from unit-only runs.
    • Improved test organization by categorizing integration tests separately for clearer execution control.
  • Documentation

    • Updated contribution guidelines with clear instructions and visuals on running unit tests for quicker feedback.
    • Expanded documentation to include details on the new unit test plan for enhanced clarity.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 13, 2025

Walkthrough

This pull request introduces new and updated Xcode scheme files to manage the build, test, launch, profile, analyze, and archive actions for the project. The configuration now explicitly references test plans instead of auto-creating them. New test plan files have been added for both all tests and unit tests, and the workspace configuration has been updated to include the unit tests. Additionally, the integration tests in the code have been tagged for better categorization, and the documentation is enhanced with instructions on running only unit tests.

Changes

File(s) Change Summary
.swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme
.swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme
New scheme files introduced for defining build, test, launch, profile, analyze, and archive actions.
.swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme Modified TestAction: removed shouldAutocreateTestPlan attribute and added explicit <TestPlans> references for AllTests.xctestplan and UnitTests.xctestplan.
AblyChat.xcworkspace/contents.xcworkspacedata Added a new <FileRef> element referencing the UnitTests.xctestplan to include unit tests in the workspace.
CONTRIBUTING.md New section "Running only the unit tests" added with guidance and a screenshot for activating the UnitTests test plan.
TestPlans/AllTests.xctestplan
TestPlans/UnitTests.xctestplan
New test plan files created with JSON structures to define test configurations and targets for all tests and unit tests respectively.
Tests/AblyChatTests/IntegrationTests.swift Added a new static integration tag (@Tag static var integration) and updated the @Suite annotation to include .tags(.integration) to better categorize integration tests.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant IDE as Xcode IDE
    participant Scheme as Scheme Files
    participant TP as Test Plan Loader
    participant TR as Test Runner

    Dev->>IDE: Initiate test run
    IDE->>Scheme: Load scheme configurations (AblyChat, BuildTool)
    Scheme->>TP: Retrieve associated test plans (AllTests, UnitTests)
    TP-->>IDE: Return test plan details
    Dev->>IDE: Select UnitTests plan
    IDE->>TR: Execute unit tests (skipping integration tests)
    TR-->>IDE: Return test results
Loading

Suggested reviewers

  • maratal
  • umair-ably

Poem

I'm a hopping coder, soft and spry,
New schemes and tests catch my keen eye.
I dart through code like a playful breeze,
With unit tests lined up as fine as these.
A bouncy cheer from this little rabbit—
Code, tests, and joy? Absolutely fab-it!


🪧 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.

@github-actions github-actions bot temporarily deployed to staging/pull/237/AblyChat March 13, 2025 14:37 Inactive
Copy link
Copy Markdown

@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

🧹 Nitpick comments (2)
CONTRIBUTING.md (1)

22-26: Fix typo in documentation

There's a minor typo in the description - the word "the" is repeated.

-There is a test plan called `UnitTests` which will run only the the unit tests. These tests are very quick to execute, so it's a useful option to have for quick feedback when developing.
+There is a test plan called `UnitTests` which will run only the unit tests. These tests are very quick to execute, so it's a useful option to have for quick feedback when developing.
🧰 Tools
🪛 LanguageTool

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

TestPlans/AllTests.xctestplan (1)

1-24: Consider adding the same default options as in UnitTests plan

The AllTests plan looks good but for consistency with the UnitTests plan, consider adding the same default option for enabling test timeouts.

  "defaultOptions" : {
-
+    "testTimeoutsEnabled" : true
  },

This would ensure consistent timeout behavior across both test plans.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0294674 and d38179e.

⛔ Files ignored due to path filters (1)
  • images/unit-tests-test-plan.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme (1 hunks)
  • AblyChat.xcworkspace/contents.xcworkspacedata (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • TestPlans/AllTests.xctestplan (1 hunks)
  • TestPlans/UnitTests.xctestplan (1 hunks)
  • Tests/AblyChatTests/IntegrationTests.swift (1 hunks)
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

⏰ Context from checks skipped due to timeout of 90000ms (12)
  • GitHub Check: Example app, tvOS (Xcode 16)
  • GitHub Check: Example app, iOS (Xcode 16)
  • GitHub Check: Xcode, tvOS (Xcode 16)
  • GitHub Check: Example app, macOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16)
  • GitHub Check: Xcode, iOS (Xcode 16)
  • GitHub Check: Xcode, macOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16)
  • GitHub Check: SPM, release configuration (Xcode 16)
  • GitHub Check: SPM (Xcode 16)
  • GitHub Check: check-documentation
🔇 Additional comments (9)
AblyChat.xcworkspace/contents.xcworkspacedata (1)

4-6: LGTM: Test plan reference correctly added to workspace

The FileRef element for the UnitTests.xctestplan is properly added to the workspace, making the unit tests plan accessible within the development environment.

TestPlans/UnitTests.xctestplan (1)

1-29: Well-structured test plan for unit tests

The test plan is properly configured to:

  • Skip integration tests by filtering out the ".integration" tag
  • Enable test timeouts by default
  • Target the AblyChatTests test bundle

This configuration will effectively isolate and run only unit tests, which aligns perfectly with the PR objective.

CONTRIBUTING.md (1)

24-26: Good use of screenshot for visual guidance

Including a screenshot showing how to activate the UnitTests test plan is very helpful for contributors who may be unfamiliar with Xcode test plans.

🧰 Tools
🪛 LanguageTool

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

.swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme (1)

30-39: Well-structured test plan configuration.

The change from auto-creating test plans to explicitly referencing predefined test plans is well-implemented. This configuration now supports both the complete test suite (AllTests) and the unit tests only option (UnitTests), which directly supports the PR objective of allowing developers to run only unit tests.

Tests/AblyChatTests/IntegrationTests.swift (2)

5-8: Good implementation of test tagging.

The extension to Tag with the integration static property is well-documented and provides a clear way to categorize tests. This is essential for the test filtering mechanism to work properly.


13-13: Appropriate tagging of the integration test suite.

The update to the @Suite annotation properly tags this entire struct as integration tests, which will allow the test plans to selectively include or exclude these tests based on the tag.

.swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme (1)

1-78: Properly configured scheme for the BuildTool target.

This new scheme file correctly configures all the necessary build, test, launch, profile, analyze, and archive actions for the BuildTool target. It follows standard Xcode scheme configuration practices.

.swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme (2)

45-53: Consistent test plan configuration across schemes.

The test plans configuration here matches that in the AblyChat.xcscheme file, ensuring consistent behavior between the single-target and package-level schemes. This is good practice for maintaining a predictable developer experience.


9-38: Comprehensive build configuration for package targets.

The build action properly includes both the AblyChat and BuildTool targets, ensuring that all necessary components are built when working with the package-level scheme.

@lawrence-forooghian lawrence-forooghian force-pushed the add-ability-to-run-unit-tests branch from d38179e to 33af042 Compare March 13, 2025 14:39
@github-actions github-actions bot temporarily deployed to staging/pull/237/AblyChat March 13, 2025 14:41 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the add-ability-to-run-unit-tests branch from 33af042 to b3d6458 Compare March 13, 2025 14:42
@github-actions github-actions bot temporarily deployed to staging/pull/237/AblyChat March 13, 2025 14:43 Inactive
Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

24-24: Fix Minor Typographical and Stylistic Issues

There is a duplicated word ("the the") that should be corrected. Additionally, consider simplifying the phrasing to avoid over-emphasis with "very quick."
Below is a suggested revision:

-There is a test plan called `UnitTests` which will run only the the unit tests. These tests are very quick to execute, so it's a useful option to have for quick feedback when developing.
+There is a test plan called `UnitTests` which will run only the unit tests. These tests execute quickly, providing useful feedback during development.
🧰 Tools
🪛 LanguageTool

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between d38179e and b3d6458.

⛔ Files ignored due to path filters (1)
  • images/unit-tests-test-plan-screenshot.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme (1 hunks)
  • AblyChat.xcworkspace/contents.xcworkspacedata (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • TestPlans/AllTests.xctestplan (1 hunks)
  • TestPlans/UnitTests.xctestplan (1 hunks)
  • Tests/AblyChatTests/IntegrationTests.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • AblyChat.xcworkspace/contents.xcworkspacedata
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme
  • Tests/AblyChatTests/IntegrationTests.swift
  • TestPlans/AllTests.xctestplan
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme
  • .swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme
  • TestPlans/UnitTests.xctestplan
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Example app, tvOS (Xcode 16)
  • GitHub Check: Example app, iOS (Xcode 16)
  • GitHub Check: Example app, macOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16)
  • GitHub Check: Xcode, tvOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16)
  • GitHub Check: SPM (Xcode 16)
  • GitHub Check: Xcode, iOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16)
  • GitHub Check: Xcode, macOS (Xcode 16)
  • GitHub Check: SPM, release configuration (Xcode 16)
🔇 Additional comments (1)
CONTRIBUTING.md (1)

22-27: New Unit Tests Section Added Successfully

The new section clearly details the process for running only the unit tests and includes an illustrative screenshot, which enhances usability. This aligns well with the PR objective of speeding up feedback during development.

🧰 Tools
🪛 LanguageTool

[duplication] ~24-~24: Possible typo: you repeated a word.
Context: ... called UnitTests which will run only the the unit tests. These tests are very quick ...

(ENGLISH_WORD_REPEAT_RULE)


[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...nly the the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

@lawrence-forooghian lawrence-forooghian force-pushed the add-ability-to-run-unit-tests branch from b3d6458 to 4e3af17 Compare March 13, 2025 14:49
@github-actions github-actions bot temporarily deployed to staging/pull/237/AblyChat March 13, 2025 14:50 Inactive
This excludes the long-running integration test. Useful for quick
feedback when developing, and also for quickly checking that we haven't
accidentally introduced a long-running unit test.
Copy link
Copy Markdown

@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

🧹 Nitpick comments (1)
CONTRIBUTING.md (1)

22-29: Clarify and polish the new "Running only the unit tests" section.
The newly added section effectively guides contributors on how to activate the UnitTests test plan with a helpful screenshot. A small improvement would be to remove the intensifier "very" in the sentence on line 24 for more concise language. For example, you might consider changing “These tests are very quick to execute” to “These tests execute quickly.”

🧰 Tools
🪛 LanguageTool

[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...un only the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3af17 and 1cb77c5.

⛔ Files ignored due to path filters (1)
  • images/unit-tests-test-plan-screenshot.png is excluded by !**/*.png
📒 Files selected for processing (8)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme (1 hunks)
  • .swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme (1 hunks)
  • AblyChat.xcworkspace/contents.xcworkspacedata (1 hunks)
  • CONTRIBUTING.md (1 hunks)
  • TestPlans/AllTests.xctestplan (1 hunks)
  • TestPlans/UnitTests.xctestplan (1 hunks)
  • Tests/AblyChatTests/IntegrationTests.swift (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (7)
  • TestPlans/UnitTests.xctestplan
  • AblyChat.xcworkspace/contents.xcworkspacedata
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat.xcscheme
  • .swiftpm/xcode/xcshareddata/xcschemes/BuildTool.xcscheme
  • Tests/AblyChatTests/IntegrationTests.swift
  • TestPlans/AllTests.xctestplan
  • .swiftpm/xcode/xcshareddata/xcschemes/AblyChat-Package.xcscheme
🧰 Additional context used
🪛 LanguageTool
CONTRIBUTING.md

[style] ~24-~24: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...un only the unit tests. These tests are very quick to execute, so it's a useful option to ...

(EN_WEAK_ADJECTIVE)

⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: Example app, tvOS (Xcode 16)
  • GitHub Check: Xcode, tvOS (Xcode 16)
  • GitHub Check: Example app, iOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, tvOS (Xcode 16)
  • GitHub Check: Xcode, iOS (Xcode 16)
  • GitHub Check: Example app, macOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, iOS (Xcode 16)
  • GitHub Check: Xcode, macOS (Xcode 16)
  • GitHub Check: Xcode, release configuration, macOS (Xcode 16)
  • GitHub Check: SPM (Xcode 16)
  • GitHub Check: SPM, release configuration (Xcode 16)

@lawrence-forooghian lawrence-forooghian merged commit f86f569 into main Mar 13, 2025
17 checks passed
@lawrence-forooghian lawrence-forooghian deleted the add-ability-to-run-unit-tests branch March 13, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants