Posts

Showing posts with the label webService

How to test a SF webService?

We can simply initialize the webService class and invoke the webService method in APEX.  Example: @isTest private class testMyWebService {         static testMethod void testMyWebSvc()   {       SampleApexWebSvc.AccountInfo act = new Sampl eApexWebSvc.AccountInfo();       act.AcctName = 'test';       act.AcctNumber = 123;       SampleApexWebSvc.createAccount( act );              Account[] a = [select AccountNumber from Acc ount where AccountNumber = '123'];       System.assertEquals(a.size(), 1);   } } Reference: http://boards.developerforce.com/t5/Apex-Code-Development/Testing-APEX-Web...