The error is:
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_USERNAME, Duplicate Username.
The username already exists in this or another Salesforce organization. Usernames must be unique across all Salesforce organizations. To resolve, use a different username (it doesn't need to match the user's email address). : [Username] Class.testForActivityTrigger.testRunAs: line 11, column 1
@isTest(SeeAllData=true)
Public class testForActivityTrigger{
public static testMethod void testRunAs() {
Profile p = [SELECT Id FROM Profile WHERE Name='BLP_NA'];
User u = new User(Alias = 'standt', Email='[email protected]',
EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',
LocaleSidKey='en_US', ProfileId = p.Id,
TimeZoneSidKey='America/Los_Angeles', UserName='[email protected]');
System.runas(u){
Account acct = new Account(Name = 'Apex Test');
insert acct;
Task tsk1 = new Task(WhatId = acct.Id, Subject = 'Email: apex test', ActivityDate = date.today(), Status = 'Completed');
insert tsk1;
Property__c objProperty = new Property__c(name = 'Apex Test');
insert objProperty;
Property_Relation__c objPropRelation = new Property_Relation__c(Property__c = objProperty.id , Account__c =acct.Id );
insert objPropRelation ;
}
}
}