Ability to easily change environment that you run Apex Tests towards

Issue #2581 open
Petter Eikeland created an issue

When an Apex Test fails in a certain environment, e.g. PROD, I would like to ad-hoc choose an environment to run the Apex tests towards. I.e. a different environment than your project connection (default). Preferably with a similar user experience that the built-in Anonymous Apex feature has.

I see there is a way to modify the run configurations so that certain tests are executed towards a certain environment. But that configuration is saved for those tests until reverted if I’m not mistaken.

Comments (3)

  1. Scott Wells repo owner
    • changed status to open

    Hi. If I understand the request correctly, you're asking for a prompt, likely optional, that's shown when unit test execution fails allowing you to re-run those tests against a different connection/org, correct? There's already an action to re-run failed tests, so potentially that action would show the user a connection selector (again, if some new option was enabled) for the org against which failed tests should be executed.

    Is that a correct understanding of the request?

  2. Petter Eikeland reporter

    Hi Scott,

    I think the request could be better described as the ability to set/change the connection before running a test execution. An optional prompt like you describe would solve the requirement, if implemented both on initial test executions and reruns. If the option was only shown on test reruns, I would always have to first run the test execution against the “wrong” environment before I get the option of re-running it against the correct environment. E.g. when running a Test directly:

    An optional prompt would also give 1 extra click every Test Execution.

    I think the way the Anonymous Apex feature is implemented is the way I envisioned it. I.e. use the “overridden” connection (if it exists), if not use default connection. This way, other users wouldn’t need to get this new prompt they didn’t ask for, and it would utilize the default connection to avoid behavior regression for other users. And it would give a holistic UI handling and behavior when handling connections:

    Summarized in ACs:

    • I want to be able to select the connection to run test executions against, before running my tests
    • If I haven’t selected a connection, the default connection should be used
    • If the connection has expired (e.g. environment has been deleted), the default connection should be utilized

  3. Log in to comment