• TristanLS
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies

Every single tests in my managed package that uses System.runAs(<user>) fails after Spring '11 upgrade.

 

Here are some examples of things that used to pass but now fail:

 

static Profile p = [select id from profile where name ='Standard User'];

static User u1 = new User(

    alias = 'testuser',

    email = 'testuser@test.com',

    emailencodingkey='UTF-8',

    lastname = 'User',

    languagelocalekey='en_US',

    localesidkey='en_US',

    profileid = p.id,

    timezonesidkey='America/Chicago',

    username='testuser@testmagic.com'

  );

static User u2 = new User(...);

 

static testMethod void doAnythingAtAllAsSomeoneElse() {

  Setting__c s;

  System.runAs(u2) {

    s = new Setting__c(Name = 'skipIntro', Value__c = 'true');

    insert s;

  }

  System.runAs(u1) {

    settings = new MySettings();

  }

 

  System.assert(settings.settingsMap.get('skipIntro') == null);

 

  delete s;

}

 

The test above used to work fine. In this particular instance, when it gets to "insert s;", it wll fail with "System.TypeException: DML operation INSERT not allowed". In a different test, it will tell me that static objects that were created aren't there and can't be referenced.

 

Are there some sort of permissions / testing / System.runAs changes in Spring '11 I'm not aware of?

 

Thanks,

 

Tristan

Ok, I've been working with the IDE for a while, and when it comes to saving work in progress, it goes from bad to ridiculous. If I have automatic builds on, every time I save, depending on the connection, everything freezes when I have two saved actions in the queue. Why? 

 

So, I turned off automatic builds choosing to bypass the whole waiting part until I am ready to "Save to Server", at which point, when I try to save a file to server, the IDE decides that it is a good idea to take the other files and refresh them from the server, because hey, it's obviously what I wanted it to do. It is very frustrating to lose your work on the one hand, and have to stare at the hour-glass on the other.

 

Is there hope for the future here? Or do I need to build process to work around these horrible decisions/features/bugs?