Jericho / ZoomNet

.NET client library for the Zoom.us REST API v2
MIT License
68 stars 48 forks source link

Group integration tests into "suites" #313

Closed Jericho closed 1 year ago

Jericho commented 1 year ago

Currently, the integration project runs all API tests which, until recently, was fine but it is now problematic because #312 is adding ChatBot tests which require different credentials and these credentials do not seem to be allowed to invoke many of the API endpoints (such as, for example, retrieving info about the current user, getting the list of existing roles, etc.). This means that we need to be able to group our integration tests into logical groups (which I call suites) and allow the developer running the tests to specify which suite he wants to run.

I can think of three suites: API, ChatBot and WebSockets.

There is a line in TestRunner.cs where developer would be able to specify which of the three he wants to run: image

The integration test project would contain a "suite" class for each of the three scenarios: image

And each of these three classes would define the list of individual tests that are grouped toghether. Something like this: image

theit8514 commented 1 year ago

As an aside, I think that it would be great to have the different flows of the OAuth separated out in the OAuth enum. This way you could have the environment variables set in the background without having to juggle them.

OAuthAuthorizationCode -> Gets authorization code and sets refresh token. OAuthRefreshToken -> Gets and sets refresh token and access token. OAuthClientCredentials -> Gets and sets access token. For cleanliness, it should use a different access token environment variable so they don't cross contaminate. OAuthServerToServer -> Gets the account id and access token and sets access token. Same as above.

Jericho commented 1 year ago

it would be great to have the different flows of the OAuth separated out in the OAuth enum

I like this idea.

For cleanliness, it should use a different access token environment variable so they don't cross contaminate.

Totally agree. In fact, I bumped into this problem when running your ChatBot integration tests.

Jericho commented 1 year ago

Something along these lines:

private enum TestType
{
    Api,
    WebSockets,
    ChatBot,
}

private enum ConnectionType
{
    Jwt, // Zoom disabled the ability to create new JWT apps on June 1, 2023. The projected end-of-life for JWT apps is September 1, 2023. 
    OAuthAuthorizationCode, // Gets authorization code and sets refresh token.
    OAuthRefreshToken,      // Gets and sets refresh token and access token.
    OAuthClientCredentials, // Gets and sets access token. For cleanliness, it should use a different access token environment variable so they don't cross contaminate.
    OAuthServerToServer,    // Gets the account id and access token and sets access token. Same as above.
}
Jericho commented 1 year ago

@theit8514 I have completed this enhancement in branch feature/integration_tests_suites. Let me know if you have a minute to sanity check before I merge it. In particular, look at the new readme file in the integration tests project where I explain how to configure the tests and also included a convenient chart listing all the necessary environment variables depending on the test suite and authentication flow you select.

Jericho commented 1 year ago

I'm going to go ahead and merge this branch.

Jericho commented 1 year ago

:tada: This issue has been resolved in version 0.67.0 :tada:

The release is available on:

Your GitReleaseManager bot :package::rocket: