Skip to content

PoC: Loading test config from a central service #968

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

Closed
wants to merge 2 commits into from

Conversation

Avery-Dunn
Copy link
Collaborator

@Avery-Dunn Avery-Dunn commented Jun 6, 2025

A draft PR in MSAL Python introduced a new concept of how to set up automated testing: AzureAD/microsoft-authentication-library-for-python#825

Essentially, configuration for how to set up constants, applications, token calls, assertions, and more is all stored in a central service that every MSAL can access, allowing us to create new tests in every library simply by creating new configuration file that is processed by generic "runners" in each MSAL.

This PR achieves this by introducing a few new classes:

  • RunnerTest : Essentially just unit tests that retrieve configuration files and executes helper methods based on the contents
    • Currently just one unit test which can process config files that cover managed identity behavior
  • RunnerHelper : A set of helper methods to create MSAL objects based on the contents of a configuration file
    • Currently just makes the objects needed for the one test, but is easily expandable as we add more
  • RunnerJsonHelper : A set of helper methods to parse the configuration file
    • For simplicity, it is pretty specific to the current config structure, and in a real implementation it would be more generic
  • Shortcuts : As the name implies, some shortcuts that were taken just to make this POC quicker and easier
    • For example: simple internal classes to represent JSON objects until the config structure is finalized

For this first-draft review:

  • RunnerTest and RunnerHelper are pretty representative of what a final implementation would look like, as they mostly just need to be expanded to cover more scenarios
  • RunnerJsonHelper will likely be replaced by a more generic version that can handle any config file and reuse behavior in the library's existing JsonHelper
  • Shortcuts an essentially be ignored during a review, since none of it would be part of a 'real' implementation
  • The names of classes, methods, key-value pairs, and even the structure of the config file can all change as needed since this is not meant to be a public API, so no need to focus much on that

LOG.info("==========Executing Test Case==========");

// Get all test configurations
Map<String, JsonNode> configs = RunnerHelper.getAllTestCaseConfigs("https://smile-test.azurewebsites.net/testcases.json");
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be local or hosted in the lab.

@Avery-Dunn
Copy link
Collaborator Author

Closing, a more finalized version of this POC has been made in #970

@Avery-Dunn Avery-Dunn closed this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants