Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to test a class I'm using with a Trigger. The Trigger fires when events and tasks are created/modified/deleted.

I'm able to test the task creation just fine, but when I try to test the event creation with the code below I'm greeted with a 'Methods defined as TestMethod do not support Web service callouts, test skipped' message on the line where I'm creating the event.

Event e = new Event(subject='Test Event', whatId =, 
          startDateTime = DateTime.valueOf('2014-04-26 14:45:05'), 
          endDateTime = DateTime.valueOf('2014-04-26 14:45:05'));
insert e;

//Verify count = 1
account = [SELECT ID, activity_count__c FROM Account WHERE ID =];
System.assertEquals(1, account.activity_count__c);

I've tried using to set my dates as well as what you see above. Both provide me with the same results. Any ideas of what I'm missing?

share|improve this question

When you get that message, no line number is reported so the problem is probably occuring on insert e.

This contrived code will produce that error:

public class MyTest {

    static void test() {
        Account a = new Account(Name = ' Acme');
        insert a;
        Event e = new Event(
                Subject = 'Test Event',
                WhatId =, 
                StartDateTime = DateTime.valueOf('2014-04-26 14:45:05'), 
                EndDateTime = DateTime.valueOf('2014-04-26 14:45:05')
        insert e;

    public static void callout() {
        HttpRequest req = new HttpRequest();
        HttpResponse res = new Http().send(req);

where the insert causes some other code (trigger or workflow rule) to make a callout:

trigger MyTrigger on Event (before insert) {

Assuming you find there is a callout, you can mock it in your test to allow your test to run. (If you are not sure where it is, turn on the debug logging and run the test again and check the log.)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.