I have a apex class on salesforce sandbox account to create records in salesforce .I need to push it to my production account- How can I write a test class without having data dependencies with my production account.
I tried to write a test class on my sandbox- but realized this would not work on my production because the data in the reference objects might be different. For example- in the test class below, the value 333 is the external ID reference of another custom object in my sandbox but my production does not have the same data, so this will fail.
@isTest(SeeAllData=true)
private class TicketRestTestClass {
static testMethod void validateTicketREST() {
String ID= RESTTicketController.createticket(55643,3,'9/13/2015 22:30',333,3,3,4,300.0,'sale',2,20.0,null,111);
Ticket__c b = [SELECT Contact__c,External_TicketID__c,Activity__c,PriceType__c,Date_Time__c,Price__c FROM Ticket__c WHERE Id =:ID];
System.assertEquals('55643',string.valueOf(b.External_TicketID__c));
}
}