Sometimes when creating UnitTests I'm unable to save classes for hours at a time. It'd be great - as a workaround - to develop UnitTests using the "force cli".
However, I'm unable to execute code that has system.runas in it.
An "ERROR: UNKNOWN_EXCEPTION: admin operation already in progress" error occurs.
Is this possible?
PS C:\salesforce\dev04> force apex -test
Start typing Apex code; press CTRL-D(for Mac/Linux) / Ctrl-Z (for Windows) when finished
Test.startTest();
Id foProfile = FO_UnitTest_V2_Helper.getProfileId(FO_UnitTest_V2_Helper.FRONT_OFFICE_PROF_NAME);
User testUser = FO_UnitTest_V2_Helper.createUser(foProfile, 'T', 'User');
insert testUser;
System.runAs(testUser){
\/\/ code here
}
Test.stopTest();
^Z
Executing code...
ERROR: UNKNOWN_EXCEPTION: admin operation already in progress