1

我试图通过 apex 创建一个任务。测试工作说它是成功的。但是,当我从 Task 导出数据时,没有其他行。我无法从调试日志中判断是否有任何问题。任务上没有自定义的验证规则。请帮助并提供一种方法来解决销售队伍环境中的这种情况。

这是测试代码:

@isTest(SeeAllData=true) class HelloWorldTestClass {
    static testMethod void validateHelloWorld() {

       Task newTask = new Task(Description = 'test task',
                                    Priority = 'Normal', 
                                    Status = 'Not Started', 
                                    Subject = 'Other', 
                                    WhoId = '003P000000dnR35IAE',
                                    WhatId = '001P000000Zc5G6',
                                    Type = 'Internal Action',
                                    ActivityDate = system.today());             
       insert newTask;


    }
}

这是调试日志:

26.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
13:24:30.080 (80288000)|EXECUTION_STARTED
13:24:30.080 (80360000)|CODE_UNIT_STARTED|[EXTERNAL]|01pP00000000ziy|HelloWorldTestClass.validateHelloWorld
13:24:30.080 (80837000)|METHOD_ENTRY|[2]|01pP00000000ziy|HelloWorldTestClass.HelloWorldTestClass()
13:24:30.080 (80852000)|METHOD_EXIT|[2]|HelloWorldTestClass
13:24:30.102 (102146000)|SYSTEM_METHOD_ENTRY|[15]|System.today()
13:24:30.102 (102204000)|SYSTEM_METHOD_EXIT|[15]|System.today()
13:24:30.102 (102294000)|DML_BEGIN|[23]|Op:Insert|Type:Task|Rows:1
13:24:30.115 (115312000)|ENTERING_MANAGED_PKG|APXTConga4
13:24:30.215 (215194000)|DML_END|[23]
13:24:30.267 (215259000)|CUMULATIVE_LIMIT_USAGE
13:24:30.267|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 1 out of 10000
  Number of code statements: 2 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10
13:24:30.267|LIMIT_USAGE_FOR_NS|APXTConga4|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of code statements: 2 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10
13:24:30.267|CUMULATIVE_LIMIT_USAGE_END
13:24:30.215 (215338000)|CODE_UNIT_FINISHED|HelloWorldTestClass.validateHelloWorld
13:24:30.215 (215346000)|EXECUTION_FINISHED
4

1 回答 1

1

测试用例从不提交它们的数据库事务,因此您将无法在测试代码之外看到此记录。

于 2013-01-31T22:44:16.917 回答