Allow to indicate anonymous apex is running a test.

Issue #212 wontfix
Robert Conner created an issue

I guess there is a flag where you can indicate that anonymous apex is running tests. Be nice if there was a checkbox or something to turn this on.

In my opinion this is way lower priority than the other things on the list. But just wanted to put the feature request in for one future day when everything else is stable.

Comments (7)

  1. Scott Wells repo owner

    Interesting. I remember seeing this go by a bit back and hadn't followed it closely. Thanks for logging the enhancement!

  2. Scott Wells repo owner

    Robert, looking at the provided link more closely, it appears that there are two primary use cases for this: 1) single method test execution; 2) the ability to get logged output of anonymous Apex code without actually risking changes to the system. Use case 1 is now available in IC. As noted in that thread, you could accomplish use case 2 by explicitly throwing an exception at the end of your anonymous Apex to force a rollback. Is there another use case that's driving your interest here? Just trying to understand the motivation for this better...

  3. Robert Conner reporter

    Nope. Just the ability to run code to see if it works and not actually modify any data. It never occurred to me to throw an exception at the end. That is a nifty trick that I could use.

  4. Scott Wells repo owner

    Thanks for following up. Given that this isn't inherently support by Salesforce and the most I could do would be to append a thrown exception to the end of the provided Apex, do you mind if I resolve this?

  5. Log in to comment