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
Eyal_WizEyal_Wiz 

Help Needed!

hey guys,
I was suppose to upload an application that i've wrote today and i have a really big problem with code coverage and testing.
i've wrote this trigger that does something with my custom objects.
trigger Check_Sold_Out on Class_Registration__c (after delete) { Class_Registration__c[] Current = Trigger.old; Class__c current_class = [select Id,Sold_Out__c from Class__c where Id=:Current[0].Class__c for update]; Class__C[] Classes= [select Name,Seat_Capacity__c, Location__c,Class_Date__c from Class__c where Id=:Current[0].Class__c ]; User[] Users= [select Email from User where Id=:Current[0].OwnerId ]; Integer Reg_Num = [select Count() from Class_Registration__c where Class__c=:Current[0].Class__c and Registration_Status__c <> 'Cancelled' and Registration_Status__c <> 'Waiting List' ]; if (Reg_Num < Classes[0].Seat_Capacity__c){ current_class.sold_out__c = false; update current_class;} }

i wrote this apex class for testing:
public class Check_Sold_Out {

 static testMethod void myTest()
 {
  Class_Registration__c Current = [select Id from class_registration__c where Registration_Notes__c='1'];
  delete Current;
  }

}
 
 
now the thing is that i'm not sure what i should do with it. i run it and it said that i've got 100% code coverage,
but when i'm trying to upload the package it says that i've got no test method defined for this trigger.
i must be missing something here. i am really deseprate for any kind of help as i'm late on the rollout schedule.
 
any kind of help would be really appricated!!! 
 
I also be glad to pay someone for helping me with this -i need help ASAP.
 
Thanks
Eyal
 
Ron HessRon Hess
in the upload, did you include your test class in the list to be loaded?
also, test classes should create the data that they depend on, rather than assume the data exists in the production org
and matches the query that the test will depend on.
Eyal_WizEyal_Wiz
Hi Ron,
 
Thanks for your reply.
I managed to get it working very close to my deadline.
 
Thanks
Eyal