• topsecretguy
  • NEWBIE
  • 0 Points
  • Member since 2012

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

I'm writing a test class that creates a lead and converts it.  On conversion 2 new contacts are created through a trigger using data from the lead and it's this contact creation that I'm testing for.

 

The save result reports the following:  "Can not select a person account"

 

My contacts are being created using the account Id of the account created on conversion,  so,  I assume it's this account that is being created as a person account.  How can I ensure that the account created on conversion is a business account?

 

The code works perfectly well when I'm running it through the GUI and as far as I can tell,  I'm creating the lead using the same recordtype and other data.

 

Any thoughts?

All,

 

Couple of questions about managed packages and their impact on deploying a change set.

 

  1. Does the code coverage of a managed package contribute in any way to the total code coverage of the code in your org?  (assuming that the code is from a 3rd party,  e.g app exchange)
  2. If the tests of a managed package fail when all tests run,  would that stop a deployment package?
  3. If the tests of a managed package trigger a validation error in your org,  would that stop a deployment package?

I thought that managed packages contributed very little to stats in your org,  i.e they have their own set of governor limits,  the total amount of code does not contribute,  the code coverage does not contribute,  test failures will not cause your deployments to fail,  etc..

I'm writing a test class that creates a lead and converts it.  On conversion 2 new contacts are created through a trigger using data from the lead and it's this contact creation that I'm testing for.

 

The save result reports the following:  "Can not select a person account"

 

My contacts are being created using the account Id of the account created on conversion,  so,  I assume it's this account that is being created as a person account.  How can I ensure that the account created on conversion is a business account?

 

The code works perfectly well when I'm running it through the GUI and as far as I can tell,  I'm creating the lead using the same recordtype and other data.

 

Any thoughts?

Dear all,

 

I have created the following test class to test a trigger that works.  The trigger changes the value on a dependend object's picklist according to the choice of the parent object.

The test reaches only 55%.

It needs to reach 75% coverage.

Below is the test code and way beyod the trigger.

Any suggestions are more than welcome!

 

Test Code:

 

@isTest
public class testChangeofStatusinAssociate {
static testMethod void testChangeofStatusinAssociate(){
List<Account> accounts = new List<Account>{};
for(Integer i = 0; i < 30; i++){
Account a = new Account(Name = 'Test Account ' + i,
Associate_s_Title__c='dd',Status__c='Under Deactivation');
accounts.add(a);

List<Location__c> Location = new List<Location__c>{};
Location__c b = new Location__c(Location_Name__c='AAA',
Status__c='Under Deactivation');
Location.add(b);
insert Location;
}

test.startTest();
insert accounts;
test.stopTest();
}
}

 

Trigger:

trigger updateactive on Account (after update, after insert){
Location__c[] StatusToUpdate = new Location__c[]{};
for(Account  c : trigger.new ){
for(Location__c cp: [ 
select id,name,Status__c from Location__c  
where Associate__c =:c.id]){
if ( c.Status__c == 'Under Deactivation'){
cp.Status__c = 'Under Deactivation';
}
StatusToUpdate.add(cp);
}
}
if(StatusToUpdate.size()>0) 
update StatusToUpdate;
}