Goals

Proposal

There are two major changes in this proposal.

No more scope

Today, each module receives a copy of their parent scope at start time and cannot affect the enclosing test scope. This is similar to function calling in most programming languages.

To pass information from a module to future steps in a test, users are forced to return relevant data “up the stack” in the last step of the module, and then bind the module’s result into the environment in a separate step.

Based on feedback that this flow is overly confusing, Momentic will move to a model where the entire test will share a single global scope. All steps, including those within modules, will have the ability to read and write to this global scope. It will be up to the user to ensure that a module does not unexpectedly modify a global environment variable.

All data set on env

Momentic will move to a model where all test context data will be set on the env global variable. The results and inputs global variables will be deprecated. It will be the responsibility of the user to ensure that module inputs, results, and variables from the Momentic environment do not have conflicting names.

It is already possible today to bind the data returned from any step into the environment as a variable. Users should make use of this feature rather than accessing results[x] , which is prone to breakage as the ordering of steps changes.

Screenshot 2024-09-03 at 3.23.17 PM.jpg

Breaking changes

For a period of 1 month after thev1 release of the Momentic local app, Momentic will continue to support the existing results[x] and inputs.X syntax for variable modification. After this period, all access to results and inputs will cease to function. This will be accompanied by an announcement.

Migration

Scope changes: The Momentic team is not aware of any teams that currently set environment variables inside modules, so the scoping changes should require no migration. Any team that does set environments inside a module to double check that they are not shadowing any Momentic variables in the enclosing test context, including Momentic environment variables.

Variable changes: after the V1 release, teams need to migrate all references to results[i] and inputs.X to env :