Skip to content

Expand API acceptance tests #31403

Open
Open
@phil-davis

Description

@phil-davis

For each area of API do something like:

  • split the existing (usually long) feature file into smaller features. Often that can be done logically by endpoints, and the methods on those endpoints (PUT, GET, DELETE...). e.g. the provisioning API splits easily into addUser, getUser, deleteUser, addGroup, getGroup, deleteGroup... features.
  • identify endpoints that do not seem to have any scenarios. Make empty feature files for those.
  • review each feature file, and make the scenarios cover:
    • doing actions as an admin
    • doing actions as a subadmin (where appropriate)
    • doing actions as an ordinary user (which may be supposed to pass or fail depending on the particular endpoint)
    • using the endpoint without giving any authentication (for most things this is expected to fail)
    • giving the resource (e.g. file/folder/calendar...) different permissions (where appropriate)
  • make some scenarios for an API "area" that check that it works using an app password
  • think about system settings that change the behavior of the API endpoint (e.g. sharing has a lot of settings that can enable/disable various things in sharing). Make scenarios that change settings and test the changed behavior.

When writing test scenarios, as well as testing the OCS and/or HTTP status response, "always" (=as much as possible) have Then steps that confirm that the action did happen (e.g. a group now exists after the test has created it) or that some sensible data was returned in the response (e.g. for GET). For actions that are expected to fail, check that the response data is empty, or the group does not exist or... The principle here is "do not just believe everything is good because the HTTP status says so".

API areas:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions