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

chore: add tests for disabling blocks #7279

Merged
merged 3 commits into from
Jul 17, 2023

Conversation

BeksOmega
Copy link
Collaborator

@BeksOmega BeksOmega commented Jul 11, 2023

The basics

  • I branched from develop
  • My pull request is against develop
  • My code follows the style guide
  • I ran npm run format and npm run lint

The details

Resolves

Fixes #7277

Proposed Changes

Adds tests for disabling blocks via the right click context menu.

Reason for Changes

Testing is great!

Test Coverage

This is tests :P

Additional Information

N/A

@BeksOmega BeksOmega requested a review from a team as a code owner July 11, 2023 20:10
@BeksOmega BeksOmega requested a review from cpcallen July 11, 2023 20:10
@github-actions github-actions bot added PR: chore General chores (dependencies, typos, etc) and removed PR: chore General chores (dependencies, typos, etc) labels Jul 11, 2023
Comment on lines 81 to 82
let isCollapsed = await getIsCollapsed(browser, blockId);
chai.assert.isFalse(isCollapsed);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not check it's not collapsed before collappsing?

(And same below for disabling.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unit testing best practice is to only include a single set of assertions in a given test. It makes your test more readable, because it's clear what's actually under test. If you have multiple assertions, you're either testing setup (i.e. something you don't actually need to be verifying / should be verified separately), or you're testing multiple behaviors, in which case they should be split up into multiple tests.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm joining this conversation because Beka referred to it in comments on my recent PR. Personally, I don't see a lot of value in treating these as unit tests with a single assertion per test. The manual tests that they are modeled on do a sequence of actions, checking for failure at each step, in order to test that a workflow is working. While we can write these tests so that they are completely separated from each other, it seems to me this creates a lot of extra work and duplication of setup.

Personally, I would rather be able to describe the tests as a set of actions by a user, and have debugging involve stepping through those actions manually to find which one failed--even if that means that an individual test does not point you directly to the specific line that failed. For my right-click tests this could also take the form of doing all of the actions (collapse, expand, disable, enable, add comment, remove comment) one after another in a single test instead of doing each as a separate test with separate creation of the block under test.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure where this fits into formal models of testing, although in my head this is end-to-end testing.

tests/browser/test/basic_playground_test.js Outdated Show resolved Hide resolved
tests/browser/test/test_setup.js Outdated Show resolved Hide resolved
@BeksOmega
Copy link
Collaborator Author

@cpcallen ready for re-review =)

tests/browser/test/basic_playground_test.js Outdated Show resolved Hide resolved
tests/browser/test/basic_playground_test.js Outdated Show resolved Hide resolved
tests/browser/test/basic_playground_test.js Outdated Show resolved Hide resolved
@BeksOmega BeksOmega merged commit abb82a2 into google:develop Jul 17, 2023
7 checks passed
@BeksOmega BeksOmega deleted the test/disabling branch May 14, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: chore General chores (dependencies, typos, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable Function Testing
3 participants