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

[Tests-Only] Improve error reporting when getArrayOfShareesResponded response has missing data #37844

Merged
merged 2 commits into from
Aug 25, 2020

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Aug 25, 2020

Description

  1. When testing against a system that does not do sharing status requests properly yet we get results like:
    https://cloud.drone.io/owncloud/ocis-reva/948/4/7
  Scenario Outline: Search without exact match                               # /srv/app/testrunner/tests/acceptance/features/apiSharees/sharees.feature:14
    Given using OCS API version "<ocs-api-version>"                          # FeatureContext::usingOcsApiVersion()
    When user "Alice" gets the sharees using the sharing API with parameters # ShareesContext::userGetsTheShareesWithParameters()
      | search   | sharee |
      | itemType | file   |
    Then the OCS status code should be "<ocs-status>"                        # OCSContext::theOCSStatusCodeShouldBe()
    And the HTTP status code should be "<http-status>"                       # FeatureContext::thenTheHTTPStatusCodeShouldBe()
    And the "exact users" sharees returned should be empty                   # ShareesContext::theShareesReturnedShouldBeEmpty()
    And the "users" sharees returned should be                               # ShareesContext::theShareesReturnedShouldBe()
      | Sharee One | 0 | sharee1 |
    And the "exact groups" sharees returned should be empty                  # ShareesContext::theShareesReturnedShouldBeEmpty()
    And the "groups" sharees returned should be                              # ShareesContext::theShareesReturnedShouldBe()
      | ShareeGroup  | 1 | ShareeGroup  |
      | ShareeGroup2 | 1 | ShareeGroup2 |
    And the "exact remotes" sharees returned should be empty                 # ShareesContext::theShareesReturnedShouldBeEmpty()
    And the "remotes" sharees returned should be empty                       # ShareesContext::theShareesReturnedShouldBeEmpty()

    Examples:
      | ocs-api-version | ocs-status | http-status |
      | 1               | 100        | 200         |
        Notice: Undefined index: users in /srv/app/testrunner/tests/acceptance/features/bootstrap/ShareesContext.php line 152
      | 2               | 200        | 200         |
        Notice: Undefined index: users in /srv/app/testrunner/tests/acceptance/features/bootstrap/ShareesContext.php line 152

"Undefined index" is not very helpful. Adjust the code to check and fail earlier with a better message when the sharees response is missing expected data.

  1. Improve a trashbin test error message so that we know what user and trashbin path had the problem.
  Scenario Outline: deleting a file moves it to trashbin                 # /srv/app/testrunner/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature:13
    Given using <dav-path> DAV path                                      # FeatureContext::usingOldOrNewDavPath()
    When user "Alice" deletes file "/textfile0.txt" using the WebDAV API # FeatureContext::userDeletesFile()
    Then as "Alice" file "/textfile0.txt" should exist in the trashbin   # TrashbinContext::asFileOrFolderExistsInTrash()
    But as "Alice" file "/textfile0.txt" should not exist                # FeatureContext::asFileOrFolderShouldNotExist()

    Examples:
      | dav-path |
      | old      |
      | new      |
        The first trash entry is found null unexpectedly
        Failed asserting that null is not null.

The first trash entry is found null unexpectedly is not really helpful, and, specially in scenario examples, it is not obvious which step caused the problem.

How Has This Been Tested?

CI

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #37844 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #37844   +/-   ##
=========================================
  Coverage     64.75%   64.75%           
  Complexity    19396    19396           
=========================================
  Files          1285     1285           
  Lines         75762    75762           
  Branches       1333     1333           
=========================================
  Hits          49057    49057           
  Misses        26313    26313           
  Partials        392      392           
Flag Coverage Δ Complexity Δ
#javascript 54.03% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.93% <ø> (ø) 19396.00 <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5804220...f1bb17b. Read the comment docs.

@phil-davis phil-davis force-pushed the improve-error-handling-getArrayOfShareesResponded branch from f1bb17b to 117b79b Compare August 25, 2020 07:31
@phil-davis phil-davis merged commit d65b8b5 into master Aug 25, 2020
@phil-davis phil-davis deleted the improve-error-handling-getArrayOfShareesResponded branch August 25, 2020 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants