我试图通过apex创建一个任务。测试工作表明它是成功的。但是,当我从Task导出数据时,没有其他行。我无法判断调试日志中是否有任何错误。任务上没有自定义验证规则。请帮助并提供一种方法来解决SalesForce环境中的这种情况。
这是测试代码:
@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
答案 0 :(得分:1)
测试用例从不提交数据库事务,因此您不会在测试代码之外对此记录有任何可见性。