function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
wsuycottwsuycott 

Eclipse deployment headaches - multiple classes/triggers

Have already deployed from eclipse projects successfully into one of several production orgs.  In my current sandbox org and eclipse project I have 1 trigger and 1 class that are already deployed to production, and have created another trigger and another class that when tested in sandbox show 100% code coverage.  When running the tests in Eclipse however one time it will show that one class/trigger tested fine and the other class/trigger failed.  I resave these and run the test in Eclipse again, and this time the previously failed class/trigger are now ok and the former ok class/trigger are failing.  Because one element fails the attempt to deploy - even if I am only attempting to deploy the class/trigger that passed the test ends up failing. 
 
As the documentation on the entire Eclipse/Force development is slight there is no real cookbook approach that I have thus far found to help support what will be an on-going environment wherein developers will have an increasing number of classes/triggers that were developed OR some that are still in a state of development that aren't ready to deploy - and all of them impacting(preventing) the deployment of a class/trigger that IS ready for deployment.  It is impacting my productivity and frankly I have burned a good 20 hours now trying to get well covered code out of my sandbox and into production.
 
Any tips on how to handle this????
JonPJonP
What version of the IDE are you using?  Have you upgraded to the April 1 minor release?  (v12.0.2.200803272100)
wsuycottwsuycott
I updated to the latest IDE last week, and in fact ran the check again this morning just to be sure there wasn't something newer.  If this is the type of action that prior releases exhibited, then I may be faced with uninstalling the whole Eclipse and IDE and reinstalling from scratch (distasteful to say the least). 
JonPJonP
Could you provide more specific information about the steps you follow when deploying your clas/trigger to production?

Also, are you using the "Deploy to Server" wizard from within a project that is otherwise pointing at your Sandbox?  Or have you created a project directly against your production org?

Thanks,
Jon
wsuycottwsuycott
I have resorted to commenting out, then deleting the other classes and triggers from sandbox.  Now all that remains is the trigger and class below - and when tested in Eclipse it is 100% code coverage.  When tested in the Sandbox it is 100%.  All would "appear" fine.  Run the Deploy to Server from Eclipse and select only the trigger and class below.  Run the test deployment and it fails stating only 68% code coverage.   Apparently something is amiss - this code certainly isn't rocket science...
 
trigger:
trigger trVendorPrefill on Vendor_Product__c (before insert, before update) {
 VendorMgmtClass.conSameAsMaster(Trigger.new); //
}
Class:
public class VendorMgmtClass {

public static void conSameAsMaster(Vendor_Product__c[] vp) {
  integer i = 0; 
  for(i=0; i < vp.size(); i++) {
   Master_Vendor__c v = [Select Primary_vendor_contact__c,
         Primary_contact_title__c,
         Primary_contact_phone__c,
         Mobile_phone__c,
         Fax__c,
         Email__c,
         Product_manager__c
         from Master_Vendor__c where Id = :vp[i].Vendor__c ];
   if(vp[i].Contact_same_as_master__c == True) {
      vp[i].Contact_Name__c = v.Primary_vendor_contact__c;
      vp[i].Title__c = v.Primary_contact_title__c;
      vp[i].Phone__c = v.Primary_contact_phone__c;
      vp[i].Email__c = v.Email__c;
      vp[i].Mobile_phone__c = v.Mobile_phone__c;
      vp[i].Fax__c = v.Fax__c;
      }  // end of if contact same as master == true
   if(vp[i].Relationship_same_as_master__c == True) {
    // More fields to copy from master record to this detail record
    vp[i].Product_Manager__c = v.Product_manager__c;
   }
  } // end of for vendor loop on trigger
 }
 
  //********************************************
  //Begin test coverage for method conSameAsMaster
  public static testMethod void testconSameAsMasterTest()
  {
       
   //Create a Master Vendor rec
   Master_Vendor__c mvc1 = new Master_Vendor__c(Name='testrec##',
   primary_contact_phone__c = '4141111111',
   email__c = 'mytest@mv.com',
   mobile_phone__c = '4141112222',
   fax__c = '4141113333');
   insert mvc1;
   vendor_contact__c vc = new vendor_contact__c(name='name##',
   master_vendor__c = mvc1.Id);
   insert vc;
   mvc1.primary_contact__c = vc.Id;
   update mvc1;
      Vendor_Product__c myVP = new Vendor_Product__c(Name = 'testvendor##',
      vendor__c = mvc1.Id,
      relationship_same_as_master__c = True,
      contact_same_as_master__c = True);
      insert myVP;
  }

  //End test coverage for method conSameAsMaster  
  //******************************************* 
}