You need to sign in to do that
Don't have an account?
Michel M.
Test Coverage Issue ...
Hello Guys,
I have spent a few hours developping a simple code, and now I am facing serious problem deploying that code. I really don't understand why my Class is not covered by the test I am running ...
I have a test method like this which creates two Accounts, right ?
Code:
And the creation of these two accounts should fire following trigger, still right ?
Code:
Code:
Code Coverage is 100% but only for the trigger ...
No information for my class ... and when I try to deploy it, then it tells me that my class is not covered enough.
Any help or ideas would be appreciated.
Regards,
Michel
I have spent a few hours developping a simple code, and now I am facing serious problem deploying that code. I really don't understand why my Class is not covered by the test I am running ...
I have a test method like this which creates two Accounts, right ?
Code:
public class TMSBUTopLevel {
public static testMethod void mytest(){
Test.startTest();
Account a = new Account(name='test');
Account b = new Account(name='test2');
a.Owning_Organization__c='test-test';
insert a;
insert b;
Test.stopTest();
}
}
And the creation of these two accounts should fire following trigger, still right ?
Code:
trigger accountSBUIns on Account (before insert) {Which should call the method in this class :
Account[] testAcc = Trigger.new;
accountSBU.registerSBU(testAcc);
}
Code:
public class accountSBU {But for an unknow reason, when I run the test my coverage results only "covers" the trigger ....
public static void registerSBU(Account[] accgr){
for(Account a:accgr){
String[] sbuLevels = a.Owning_Organization__c.split('-');
if(sbuLevels[0].equals('ENGR') || sbuLevels[0].equals('FIN') || sbuLevels[0].equals('FS&RE') || sbuLevels[0].equals('HR') ||sbuLevels[0].equals('IT&S') ||sbuLevels[0].equals('LEGL') ||sbuLevels[0].equals('S&L')){
sbuLevels[0]='Function';
}
if(sbuLevels[0].equals(' ') || sbuLevels[0].equals('') || sbuLevels[0]== null){
sbuLevels[0]='Not Defined';
}
a.Owning_SBU_Org__c = sbuLevels[0];
}
}
}
Code Coverage is 100% but only for the trigger ...
No information for my class ... and when I try to deploy it, then it tells me that my class is not covered enough.
Any help or ideas would be appreciated.
Regards,
Michel