+ Start a Discussion

Test class for Metadata API for updating picklist values

I've created a trigger that calls the metadata api (class created from metadata api wsdl) for updating the picklist value in a sobject. Now with this working fine i need to deploy it for which the code coverage is required.

I wrote the below piece of code to test:
static testmethod void UpdateSalesOwnerPicklist_Tr(){
		        user usr =  new user();
		        usr.LastName = 'Phil';
		        usr.Alias = 'Sphil';
		        usr.Email = 'non@none.co.uk';
		        usr.Username = 'spencer.phil@capita.co.uk';
		        usr.CommunityNickname = 'Phil';
		        usr.TimeZoneSidKey = 'Europe/London';
		        usr.LocaleSidKey = 'en_GB';
		        usr.EmailEncodingKey = 'ISO-8859-1';
		        usr.ProfileId = '00e2400000103uxAAA';
		        usr.LanguageLocaleKey = 'en_US';
		        //insert user
		        insert usr;
but for the error Methods defined as TestMethod do not support Web service callouts

Following this i did refer the link  https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_callouts_wsdl2apex_testing.htm    but quite confused on how to approach the test class? any help on this please?
Hi PS81,
Check with belwo link it wil help !!

Let me know if it helps !!
hi manoj

thats the link i had already posted and referd in my question....
Nagaraj SVNagaraj SV

Hi PS81,

I have worked on updating picklist values using Metadata API but current issue is I am getting the below error while writing test class.

Colud ypu please help me 

Error:Methods defined as TestMethod do not support Web service callouts