6

Is there a way to execute anonymous code in a way that existing data on the org is not accessible, like when test methods execute?

A proper test method cannot be used as they are only allowed in top level classes. The only way is then to write real test methods and that's just a load of work when I usually need these things to just quickly see if something works as expected.

1 Answer 1

5

Unfortunately, no, that cannot be done; test methods are special in that regard. The closest would probably be working in a sandbox with limited data or creating bespoke unit tests.

5
  • I think I might post this as an idea on the IdeaExchange. It has merit. That, or someone else should.
    – sfdcfox
    Commented Nov 19, 2013 at 15:52
  • 6
    The idea has already been posted success.salesforce.com/ideaView?id=08730000000inJZAAY
    – BarCotter
    Commented Nov 19, 2013 at 15:54
  • Voted; having a truly anonymous/test session would be great.
    – Mike Chale
    Commented Nov 19, 2013 at 16:10
  • Ok, so no. It's good that it's in ideas already, thanks for the link.
    – zdropic
    Commented Nov 19, 2013 at 16:23
  • If anyone is at Dreamforce and is reading this. Could they hunt down @thomas Dvornik Twitter:amphro and politely encourage him that it is a good idea. Any of the Developer Evangelism team would also be acceptable :) Commented Nov 19, 2013 at 19:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .