-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
12Questions
-
14Replies
APEX Testing Error
Example:
Object X
Fields: TestPick ( Picklist ), Values: 'A', 'B', 'C'
TestText ( Text )
Class A
Test Method 1:
1. Create Custom Object X, TestPick = 'D', TestText = 'Test'
1a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test'
1b. Can Query for Custom Object Using Custom Picklist Field. <-- Custom-field query only works here
- SELECT ID FROM X__c WHERE TestPick = 'D'
2. Create Custom Object X, TestPick = 'E', TestText = 'Test2'
2a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test2'
2b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'E'
Test Method 2:
1. Create Custom Object X, TestPick = 'F', TestText = 'Test3'
1a. Can Query for Custom Object Using Standard Field.
- SELECT ID FROM X__c WHERE TestText = 'Test3'
1b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'F'
Class B
Test Method 1:
1. Create Custom Object X, TestPick = 'D', TestText = 'Test'
1a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test'
1b. Can Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'D'
2. Create Custom Object X, TestPick = 'E', TestText = 'Test2'
2a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test2'
2b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'E'
Test Method 2:
1. Create Custom Object X, TestPick = 'F', TestText = 'Test3'
1a. Can Query for Custom Object Using Standard Field.
- SELECT ID FROM X__c WHERE TestText = 'Test3'
1b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'F'
When deploying code to Sandbox or Producton enviroment, you encounter the problem above.
Note: If you deploy to Sandbox without running all tests, you will encounter the problem below the FIRST time you run tests in Sandbox. The SECOND time you run the test in sandbox, the problem below will be fixed.
Below is an example using a custom object "Program__c" w/ the custom picklist field "Zone__c". This can be modified replicate the issue with any object w/ custom picklist fields. Also, Class B, Test 1, Query 1a will pass on the first TEST.
Apex Code:
public class APEXTestMethod {
public static testMethod void runTests1() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test1_A';
insert prog;
System.debug( 'APEXTestMethod Test1_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test1_A Lookup By Custom Field' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_A'] );
System.debug( 'APEXTestMethod Test1_A Lookup By Custom Field' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test1_B';
insert prog;
System.debug( 'APEXTestMethod Test1_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test1_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_B'] );
}
public static testMethod void runTests2() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test2_A';
insert prog;
System.debug( 'APEXTestMethod Test2_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test2_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test2_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test2_B';
insert prog;
System.debug( 'APEXTestMethod Test2_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test2_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test2_B'] );
}
}
public class APEXTestMethod2 {
public static testMethod void runTests1() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test1_A';
insert prog;
System.debug( 'APEXTestMethod2 Test1_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test1_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_A'] );
System.debug( 'APEXTestMethod2 Test1_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test1_B';
insert prog;
System.debug( 'APEXTestMethod2 Test1_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test1_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_B'] );
}
public static testMethod void runTests2() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test2_A';
insert prog;
System.debug( 'APEXTestMethod2 Test2_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test2_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test2_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test2_B';
insert prog;
System.debug( 'APEXTestMethod2 Test2_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test2_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test2_B'] );
}
}
Debug Log Output:
[sf:deploy]
[sf:deploy] *** Beginning Test 1: APEXTestMethod.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 7, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 7, column 13: DML Operation executed in 197 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 9, column 10: APEXTestMethod Test1_A Lookup By ID
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 10, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 10, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 12, column 10: APEXTestMethod Test1_A Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 13, column 24: SOQL query with 1 row finished in 23 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 13, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 15, column 10: APEXTestMethod Test1_A Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 16, column 24: SOQL query with 1 row finished in 20 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 16, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 23, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 23, column 13: DML Operation executed in 121 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 25, column 10: APEXTestMethod Test1_B Lookup By Id
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 26, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 26, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_B, Id=a0H30000000ikWoEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 28, column 10: APEXTestMethod Test1_B Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 29, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 29, column 10: ()
[sf:deploy] 20081201225632.568:Class.APEXTestMethod: line 3, column 35: returning from end of method public static testMethod void runTests1() in 410 ms
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 5 out of 100
[sf:deploy] Number of query rows: 4 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 16 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] *** Ending Test APEXTestMethod.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] *** Beginning Test 2: APEXTestMethod.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 37, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 37, column 13: DML Operation executed in 118 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 39, column 10: APEXTestMethod Test2_A Lookup By ID
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 40, column 24: SOQL query with 1 row finished in 12 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 40, column 10: (Program__c:{Zone__c=APEXTestMethod_Test2_A, Id=a0H30000000ikWpEAI})
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 42, column 10: APEXTestMethod Test2_A Lookup By Custom Field
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 43, column 24: SOQL query with 0 rows finished in 14 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 43, column 10: ()
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 47, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 47, column 13: DML Operation executed in 114 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 49, column 10: APEXTestMethod Test2_B Lookup By Id
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 50, column 24: SOQL query with 1 row finished in 15 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 50, column 10: (Program__c:{Zone__c=APEXTestMethod_Test2_B, Id=a0H30000000ikWqEAI})
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 52, column 10: APEXTestMethod Test2_B Lookup By Custom Field
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 53, column 24: SOQL query with 0 rows finished in 17 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 53, column 10: ()
[sf:deploy]
[sf:deploy] Class.APEXTestMethod.runTests2: line 55, column 9
[sf:deploy]
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 4 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 15 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] Stack frame variables and sizes:
[sf:deploy] Frame0
[sf:deploy]
[sf:deploy] *** Ending Test APEXTestMethod.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] *** Beginning Test 3: APEXTestMethod2.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 7, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 7, column 13: DML Operation executed in 108 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 9, column 10: APEXTestMethod2 Test1_A Lookup By ID
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 10, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 10, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test1_A, Id=a0H30000000ikWrEAI})
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 12, column 10: APEXTestMethod2 Test1_A Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 13, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 13, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 15, column 10: APEXTestMethod2 Test1_A Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 16, column 24: SOQL query with 0 rows finished in 16 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 16, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 23, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 23, column 13: DML Operation executed in 109 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 25, column 10: APEXTestMethod2 Test1_B Lookup By Id
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 26, column 24: SOQL query with 1 row finished in 10 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 26, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test1_B, Id=a0H30000000ikWsEAI})
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 28, column 10: APEXTestMethod2 Test1_B Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 29, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 29, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2: line 3, column 35: returning from end of method public static testMethod void runTests1() in 297 ms
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 5 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 16 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] *** Ending Test APEXTestMethod2.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] *** Beginning Test 4: APEXTestMethod2.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 37, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 37, column 13: DML Operation executed in 109 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 39, column 10: APEXTestMethod2 Test2_A Lookup By ID
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 40, column 24: SOQL query with 1 row finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 40, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test2_A, Id=a0H30000000ikWtEAI})
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 42, column 10: APEXTestMethod2 Test2_A Lookup By Custom Field
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 43, column 24: SOQL query with 0 rows finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 43, column 10: ()
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 47, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 47, column 13: DML Operation executed in 104 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 49, column 10: APEXTestMethod2 Test2_B Lookup By Id
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 50, column 24: SOQL query with 1 row finished in 13 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 50, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test2_B, Id=a0H30000000ikWuEAI})
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 52, column 10: APEXTestMethod2 Test2_B Lookup By Custom Field
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 53, column 24: SOQL query with 0 rows finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 53, column 10: ()
[sf:deploy]
[sf:deploy] Class.APEXTestMethod2.runTests2: line 55, column 9
[sf:deploy]
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 4 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 15 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] Stack frame variables and sizes:
[sf:deploy] Frame0
[sf:deploy]
[sf:deploy] *** Ending Test APEXTestMethod2.public static testMethod void runTests2()
[sf:deploy]
Message Edited by sduda on 12-01-2008 03:25 PM
Message Edited by sduda on 12-01-2008 03:28 PM
Message Edited by sduda on 12-01-2008 04:15 PM
Message Edited by sduda on 12-01-2008 04:26 PM
- sduda
- December 01, 2008
- Like
- 0
- Continue reading or reply
Help Text Bubble
- sduda
- November 06, 2008
- Like
- 0
- Continue reading or reply
Validation Rules w/ APEX Testing
What approach have other people used to avoid this issue?
- sduda
- October 24, 2008
- Like
- 0
- Continue reading or reply
Moving schema from test to production?
I've created a bunch of objects in our sandbox environment
and would like to move them into our production environment. What's the easiest
way to accomplish this?
I've tried creating an unmanaged package for only these new objects, however,
it automatically includes every custom object ever created (in addition to my
new objects) since they are all tied together.
- sduda
- December 20, 2007
- Like
- 0
- Continue reading or reply
APEX - Number Rounding?
N1 : Currency(3, 8)
N2 : Number(2, 0)
Using APEX, I query for this record and place into a variable named 'rec'.
Then, I use debug to print out these values to the console:
Here is what it prints out:
rec.N1 = 125.0
rec.N2 = 12.0
Then, I try to divide the two numbers:
Double N3 = rec.N1 / rec.N2;
When i print out N3, it displays:
N3 = 10.4
However, If I assign N3 = 125.0/12.0 and print out N3 again, i get:
N3 = 10.416666666666666 ( Which is the correct value... not 10.4 )
Why is APEX truncating/rounding the first value to 10.4?
- sduda
- December 17, 2007
- Like
- 0
- Continue reading or reply
Excel Connector Automation Error
"Compile Error: Automation Error: Unknown Source"
This line is highlighted in the VBA code:
Sub CreateSubMenu1(InputCtrl As CommandBarPopup)
Thanks
- sduda
- October 19, 2007
- Like
- 0
- Continue reading or reply
Eclipse APEX Synchronizing
- sduda
- September 26, 2007
- Like
- 0
- Continue reading or reply
Generating APEX Code WSDL from Production?
Thanks
Seth
- sduda
- August 27, 2007
- Like
- 0
- Continue reading or reply
Throwing Exceptions?
it says: throw <ExceptionObject>
I've tried:
throw new StringException();
throw new System.StringException();
throw StringException;
It returns the error message:
Exception type cannot be constructed
Thanks
- sduda
- August 24, 2007
- Like
- 0
- Continue reading or reply
APEX WebService - Valid Parameters?
I am trying to create a APEX code class with a method defined as a WebService. What are the valid parameter types that I can pass to this method? I tried using a Set, but it says that it's not a valid parameter type (It doesn’t give this error if the method isn't a WebService). Are only primitive data types valid? Is it possible to pass a Set of primitive data types?
- sduda
- August 23, 2007
- Like
- 0
- Continue reading or reply
Eclipse APEX plugin not saving to test
I just installed the new version of the APEX plug-in for
Eclipse. I've deleted and created a new project for the test server. When I try
to create a new trigger, it initially says as a warning:
File only saved locally, not to Salesforce
If I add anything to the Trigger and save again it says as an error:
Conflict found while saving ConfirmationTrigger.tgr to server. Remote
instance has been updated since last save or sync. Use the Synchronize
Perspective to resolve the conflict.
I've tried using the synchronize perspective with no success - I can't get rid
of the error.
- sduda
- August 21, 2007
- Like
- 0
- Continue reading or reply
Print Anything Equals Code (Add-on)
Here's how it works:
<prtany:equal Contact1.FirstName="some value" Contact1.LastName="some other value" ........ >
Displays this text only if:
Contact1.FirstName="some value" and
Contact1.LastName="some other value"
<prtany:equal Contact1.LastName="some other value 2">
Displays this text only if:
Contact1.LastName="some other value 2" and
parent equals tag is true
</prtany:equal>
</prtany:equal>
<prtany:equal Contact1.FirstName!="some value" >
Displays this text only if:
Contact1.FirstName does not equal "some value"
</prtany:equal>
(Put new code inside the merge function after the last while statement)
Code:
// remove any conditional content
while (result.indexOf("<prtany:equal") != -1) {
var level = 1;
// Find next start tag (<prtany:equal ... >)
var startTagStartPos = result.indexOf("<prtany:equal");
var startTagEndPos = result.indexOf(">", startTagStartPos);
var parsePos = startTagEndPos;
var nextStartTagPos;
var nextEndTagPos;
// Find corresponding end tag (</prtany:equal>)
do {
nextStartTagPos = result.indexOf("<prtany:equal",parsePos);
nextEndTagPos = result.indexOf("</prtany:equal", parsePos);
if( nextStartTagPos < nextEndTagPos && nextStartTagPos != -1 ) {
level = level + 1;
parsePos = nextStartTagPos + 1;
} else {
level = level - 1;
parsePos = nextEndTagPos + 1;
}
} while ( level > 0 )
if (nextEndTagPos == -1) {
throw "No equal end tag was found";
}
var endTagEndPos = result.indexOf(">", nextEndTagPos);
var conditionalString = result.substring(startTagEndPos+1,nextEndTagPos);
// Parse start tag conditions (<prtany:equal var="value" var2!="value" ... >
var statement = result.substring(startTagStartPos+1,startTagEndPos);
var reg = /(\S+?)\s*(\!?=)\s*\"(.+?)\"/g;
var match = reg.exec( statement );
while( match != null ) {
var conditionalValue = mergeData[match[1]];
if( match[2] == "!=" ) {
if (conditionalValue == match[3]) {
conditionalString = "";
}
} else {
if (conditionalValue != match[3]) {
conditionalString = "";
}
}
match = reg.exec( statement );
}
result = result.substring(0,startTagStartPos) + conditionalString + result.substring(endTagEndPos+1)
}
Message Edited by sduda on 03-29-2007 02:23 PM
Message Edited by sduda on 04-09-2007 09:28 AM
Message Edited by sduda on 04-09-2007 09:30 AM
- sduda
- March 29, 2007
- Like
- 0
- Continue reading or reply
ant deploy code question: will it test all classes in the production?
Test Class VFController_Sidebar_Summary
Tests Run 1
Test Failures 1
Code coverage total % 100
Total time (ms) 0
Class VFController_Sidebar_Summary testVFController_Sidebar_Summary 136 System.Exception: Too many query rows: 501 Class.VFController_Sidebar_Summary.getPastDueOppty: line 52, column 8
Class.VFController_Sidebar_Summary.testVFController_Sidebar_Summary: line 68, column 14
This test calss is not in the "package.xml” file. So why it runs this test? Not the one I specified in "package.xml"? Should they be independent?
- CTU007
- December 16, 2008
- Like
- 0
- Continue reading or reply
APEX Testing Error
Example:
Object X
Fields: TestPick ( Picklist ), Values: 'A', 'B', 'C'
TestText ( Text )
Class A
Test Method 1:
1. Create Custom Object X, TestPick = 'D', TestText = 'Test'
1a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test'
1b. Can Query for Custom Object Using Custom Picklist Field. <-- Custom-field query only works here
- SELECT ID FROM X__c WHERE TestPick = 'D'
2. Create Custom Object X, TestPick = 'E', TestText = 'Test2'
2a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test2'
2b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'E'
Test Method 2:
1. Create Custom Object X, TestPick = 'F', TestText = 'Test3'
1a. Can Query for Custom Object Using Standard Field.
- SELECT ID FROM X__c WHERE TestText = 'Test3'
1b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'F'
Class B
Test Method 1:
1. Create Custom Object X, TestPick = 'D', TestText = 'Test'
1a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test'
1b. Can Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'D'
2. Create Custom Object X, TestPick = 'E', TestText = 'Test2'
2a. Can Query for Custom Object Using Standard Field or non-picklist.
- SELECT ID FROM X__c WHERE TestText = 'Test2'
2b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'E'
Test Method 2:
1. Create Custom Object X, TestPick = 'F', TestText = 'Test3'
1a. Can Query for Custom Object Using Standard Field.
- SELECT ID FROM X__c WHERE TestText = 'Test3'
1b. Can't Query for Custom Object Using Custom Picklist Field.
- SELECT ID FROM X__c WHERE TestPick = 'F'
When deploying code to Sandbox or Producton enviroment, you encounter the problem above.
Note: If you deploy to Sandbox without running all tests, you will encounter the problem below the FIRST time you run tests in Sandbox. The SECOND time you run the test in sandbox, the problem below will be fixed.
Below is an example using a custom object "Program__c" w/ the custom picklist field "Zone__c". This can be modified replicate the issue with any object w/ custom picklist fields. Also, Class B, Test 1, Query 1a will pass on the first TEST.
Apex Code:
public class APEXTestMethod {
public static testMethod void runTests1() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test1_A';
insert prog;
System.debug( 'APEXTestMethod Test1_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test1_A Lookup By Custom Field' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_A'] );
System.debug( 'APEXTestMethod Test1_A Lookup By Custom Field' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test1_B';
insert prog;
System.debug( 'APEXTestMethod Test1_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test1_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test1_B'] );
}
public static testMethod void runTests2() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test2_A';
insert prog;
System.debug( 'APEXTestMethod Test2_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test2_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test2_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod_Test2_B';
insert prog;
System.debug( 'APEXTestMethod Test2_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod Test2_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod_Test2_B'] );
}
}
public class APEXTestMethod2 {
public static testMethod void runTests1() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test1_A';
insert prog;
System.debug( 'APEXTestMethod2 Test1_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test1_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_A'] );
System.debug( 'APEXTestMethod2 Test1_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test1_B';
insert prog;
System.debug( 'APEXTestMethod2 Test1_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test1_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test1_B'] );
}
public static testMethod void runTests2() {
Program__c prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test2_A';
insert prog;
System.debug( 'APEXTestMethod2 Test2_A Lookup By ID' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test2_A Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test2_A'] );
prog = new Program__c();
prog.Zone__c = 'APEXTestMethod2_Test2_B';
insert prog;
System.debug( 'APEXTestMethod2 Test2_B Lookup By Id' );
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE Id = :prog.Id] );
System.debug( 'APEXTestMethod2 Test2_B Lookup By Custom Field' );
// Should Find 1 Record, But Finds None
System.debug( [SELECT p.Id, p.Zone__c FROM Program__c p WHERE p.Zone__c = 'APEXTestMethod2_Test2_B'] );
}
}
Debug Log Output:
[sf:deploy]
[sf:deploy] *** Beginning Test 1: APEXTestMethod.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 7, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 7, column 13: DML Operation executed in 197 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 9, column 10: APEXTestMethod Test1_A Lookup By ID
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 10, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 10, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 12, column 10: APEXTestMethod Test1_A Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 13, column 24: SOQL query with 1 row finished in 23 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 13, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 15, column 10: APEXTestMethod Test1_A Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 16, column 24: SOQL query with 1 row finished in 20 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 16, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_A, Id=a0H30000000ikWnEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 23, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 23, column 13: DML Operation executed in 121 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 25, column 10: APEXTestMethod Test1_B Lookup By Id
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 26, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 26, column 10: (Program__c:{Zone__c=APEXTestMethod_Test1_B, Id=a0H30000000ikWoEAI})
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 28, column 10: APEXTestMethod Test1_B Lookup By Custom Field
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 29, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225632.568:Class.APEXTestMethod.runTests1: line 29, column 10: ()
[sf:deploy] 20081201225632.568:Class.APEXTestMethod: line 3, column 35: returning from end of method public static testMethod void runTests1() in 410 ms
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 5 out of 100
[sf:deploy] Number of query rows: 4 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 16 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] *** Ending Test APEXTestMethod.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] *** Beginning Test 2: APEXTestMethod.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 37, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 37, column 13: DML Operation executed in 118 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 39, column 10: APEXTestMethod Test2_A Lookup By ID
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 40, column 24: SOQL query with 1 row finished in 12 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 40, column 10: (Program__c:{Zone__c=APEXTestMethod_Test2_A, Id=a0H30000000ikWpEAI})
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 42, column 10: APEXTestMethod Test2_A Lookup By Custom Field
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 43, column 24: SOQL query with 0 rows finished in 14 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 43, column 10: ()
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 47, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 47, column 13: DML Operation executed in 114 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 49, column 10: APEXTestMethod Test2_B Lookup By Id
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 50, column 24: SOQL query with 1 row finished in 15 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 50, column 10: (Program__c:{Zone__c=APEXTestMethod_Test2_B, Id=a0H30000000ikWqEAI})
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 52, column 10: APEXTestMethod Test2_B Lookup By Custom Field
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 53, column 24: SOQL query with 0 rows finished in 17 ms
[sf:deploy] 20081201225632.982:Class.APEXTestMethod.runTests2: line 53, column 10: ()
[sf:deploy]
[sf:deploy] Class.APEXTestMethod.runTests2: line 55, column 9
[sf:deploy]
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 4 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 15 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] Stack frame variables and sizes:
[sf:deploy] Frame0
[sf:deploy]
[sf:deploy] *** Ending Test APEXTestMethod.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] *** Beginning Test 3: APEXTestMethod2.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 7, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 7, column 13: DML Operation executed in 108 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 9, column 10: APEXTestMethod2 Test1_A Lookup By ID
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 10, column 24: SOQL query with 1 row finished in 14 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 10, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test1_A, Id=a0H30000000ikWrEAI})
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 12, column 10: APEXTestMethod2 Test1_A Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 13, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 13, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 15, column 10: APEXTestMethod2 Test1_A Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 16, column 24: SOQL query with 0 rows finished in 16 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 16, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 23, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 23, column 13: DML Operation executed in 109 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 25, column 10: APEXTestMethod2 Test1_B Lookup By Id
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 26, column 24: SOQL query with 1 row finished in 10 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 26, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test1_B, Id=a0H30000000ikWsEAI})
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 28, column 10: APEXTestMethod2 Test1_B Lookup By Custom Field
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 29, column 24: SOQL query with 0 rows finished in 18 ms
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2.runTests1: line 29, column 10: ()
[sf:deploy] 20081201225633.282:Class.APEXTestMethod2: line 3, column 35: returning from end of method public static testMethod void runTests1() in 297 ms
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 5 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 16 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] *** Ending Test APEXTestMethod2.public static testMethod void runTests1()
[sf:deploy]
[sf:deploy] *** Beginning Test 4: APEXTestMethod2.public static testMethod void runTests2()
[sf:deploy]
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 37, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 37, column 13: DML Operation executed in 109 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 39, column 10: APEXTestMethod2 Test2_A Lookup By ID
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 40, column 24: SOQL query with 1 row finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 40, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test2_A, Id=a0H30000000ikWtEAI})
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 42, column 10: APEXTestMethod2 Test2_A Lookup By Custom Field
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 43, column 24: SOQL query with 0 rows finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 43, column 10: ()
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 47, column 13: Insert: SOBJECT:Program__c
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 47, column 13: DML Operation executed in 104 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 49, column 10: APEXTestMethod2 Test2_B Lookup By Id
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 50, column 24: SOQL query with 1 row finished in 13 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 50, column 10: (Program__c:{Zone__c=APEXTestMethod2_Test2_B, Id=a0H30000000ikWuEAI})
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 52, column 10: APEXTestMethod2 Test2_B Lookup By Custom Field
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 53, column 24: SOQL query with 0 rows finished in 15 ms
[sf:deploy] 20081201225633.582:Class.APEXTestMethod2.runTests2: line 53, column 10: ()
[sf:deploy]
[sf:deploy] Class.APEXTestMethod2.runTests2: line 55, column 9
[sf:deploy]
[sf:deploy]
[sf:deploy] Cumulative resource usage:
[sf:deploy]
[sf:deploy] Resource usage for namespace: (default)
[sf:deploy] Number of SOQL queries: 4 out of 100
[sf:deploy] Number of query rows: 2 out of 500
[sf:deploy] Number of SOSL queries: 0 out of 20
[sf:deploy] Number of DML statements: 2 out of 100
[sf:deploy] Number of DML rows: 2 out of 500
[sf:deploy] Number of script statements: 15 out of 200000
[sf:deploy] Maximum heap size: 0 out of 500000
[sf:deploy] Number of callouts: 0 out of 10
[sf:deploy] Number of Email Invocations: 0 out of 10
[sf:deploy] Number of fields describes: 0 out of 10
[sf:deploy] Number of record type describes: 0 out of 10
[sf:deploy] Number of child relationships describes: 0 out of 10
[sf:deploy] Number of picklist describes: 0 out of 10
[sf:deploy] Number of future calls: 0 out of 10
[sf:deploy] Number of find similar calls: 0 out of 10
[sf:deploy] Number of System.runAs() invocations: 0 out of 20
[sf:deploy]
[sf:deploy] Total email recipients queued to be sent : 0
[sf:deploy] Stack frame variables and sizes:
[sf:deploy] Frame0
[sf:deploy]
[sf:deploy] *** Ending Test APEXTestMethod2.public static testMethod void runTests2()
[sf:deploy]
Message Edited by sduda on 12-01-2008 03:25 PM
Message Edited by sduda on 12-01-2008 03:28 PM
Message Edited by sduda on 12-01-2008 04:15 PM
Message Edited by sduda on 12-01-2008 04:26 PM
- sduda
- December 01, 2008
- Like
- 0
- Continue reading or reply
Calling Triggers through S-Control
webService static Id makeContact(String lastName, Account a) {
Contact c = new Contact(LastName = lastName, AccountId = a.Id);
return c.id;
}
}
Ajax code
var account = sforce.SObject("Account");
var id = sforce.apex.execute("myClass","makeContact",
{a:"Smith",
b:account});
But not able to get for triggers from S-control
Message Edited by Amans on 09-19-2007 05:46 AM
- Amans
- September 19, 2007
- Like
- 0
- Continue reading or reply
Can we use apex code language script code within SControl...
I don't have much idea about S-Controls,I would like to know can we use Apex code language method within S-Controls to avoid an API call?
Is there any limitation or so?can u suggest any gud link to learn more about S-Controls.
Vineeta
- Vineeta
- September 19, 2007
- Like
- 0
- Continue reading or reply
Setting up tests
Can anyone share what they feel may be a clean and scalable way to do testing with Apex code?
thanks
Jeremy
- jeremy_r
- August 27, 2007
- Like
- 0
- Continue reading or reply
Generating APEX Code WSDL from Production?
Thanks
Seth
- sduda
- August 27, 2007
- Like
- 0
- Continue reading or reply
SOQL For Loops ...
And yes, I realize that there is a Case Contact Roles related list, but the client requires related lists on the Account and Contact objects displaying Case roles. :smileyhappy:
Code:
// we check to see if the subject has changed if (casenew.subject != caseold.subject) { // we try to batch update all case_roles with this case id // this seems to do one at a time, instead of 200 at a time for(case_role__c cr: [select id,case_subject__c from case_role__c where case__c = :casenew.id ]){ cr.case_subject__c = casenew.subject; update cr; } }Message Edited by JohnPCutler on 08-25-200703:48 PM
Message Edited by JohnPCutler on 08-26-200707:04 PM
- JohnPCutler
- August 25, 2007
- Like
- 0
- Continue reading or reply
Throwing Exceptions?
it says: throw <ExceptionObject>
I've tried:
throw new StringException();
throw new System.StringException();
throw StringException;
It returns the error message:
Exception type cannot be constructed
Thanks
- sduda
- August 24, 2007
- Like
- 0
- Continue reading or reply
Apex Help!
- machine
- August 22, 2007
- Like
- 0
- Continue reading or reply
Eclipse APEX plugin not saving to test
I just installed the new version of the APEX plug-in for
Eclipse. I've deleted and created a new project for the test server. When I try
to create a new trigger, it initially says as a warning:
File only saved locally, not to Salesforce
If I add anything to the Trigger and save again it says as an error:
Conflict found while saving ConfirmationTrigger.tgr to server. Remote
instance has been updated since last save or sync. Use the Synchronize
Perspective to resolve the conflict.
I've tried using the synchronize perspective with no success - I can't get rid
of the error.
- sduda
- August 21, 2007
- Like
- 0
- Continue reading or reply
PrintAnything, Style Sheets, Print Button
In order to allow people to easily print the output, I've added a javascript "Print" button. The problem is, however, that since PrintAnything does not accept stylesheet calls (I need to call a "media" stylesheet in this case), I am unable to use javascript code to "hide" the print button when the document is actually printed.
This means that every printout has a big "Print" button on it, which is obviously less than desirable.
Has anyone figured a way around this?
Thanks,
Seth
- Seth
- April 02, 2007
- Like
- 0
- Continue reading or reply
Print Anything Equals Code (Add-on)
Here's how it works:
<prtany:equal Contact1.FirstName="some value" Contact1.LastName="some other value" ........ >
Displays this text only if:
Contact1.FirstName="some value" and
Contact1.LastName="some other value"
<prtany:equal Contact1.LastName="some other value 2">
Displays this text only if:
Contact1.LastName="some other value 2" and
parent equals tag is true
</prtany:equal>
</prtany:equal>
<prtany:equal Contact1.FirstName!="some value" >
Displays this text only if:
Contact1.FirstName does not equal "some value"
</prtany:equal>
(Put new code inside the merge function after the last while statement)
Code:
// remove any conditional content
while (result.indexOf("<prtany:equal") != -1) {
var level = 1;
// Find next start tag (<prtany:equal ... >)
var startTagStartPos = result.indexOf("<prtany:equal");
var startTagEndPos = result.indexOf(">", startTagStartPos);
var parsePos = startTagEndPos;
var nextStartTagPos;
var nextEndTagPos;
// Find corresponding end tag (</prtany:equal>)
do {
nextStartTagPos = result.indexOf("<prtany:equal",parsePos);
nextEndTagPos = result.indexOf("</prtany:equal", parsePos);
if( nextStartTagPos < nextEndTagPos && nextStartTagPos != -1 ) {
level = level + 1;
parsePos = nextStartTagPos + 1;
} else {
level = level - 1;
parsePos = nextEndTagPos + 1;
}
} while ( level > 0 )
if (nextEndTagPos == -1) {
throw "No equal end tag was found";
}
var endTagEndPos = result.indexOf(">", nextEndTagPos);
var conditionalString = result.substring(startTagEndPos+1,nextEndTagPos);
// Parse start tag conditions (<prtany:equal var="value" var2!="value" ... >
var statement = result.substring(startTagStartPos+1,startTagEndPos);
var reg = /(\S+?)\s*(\!?=)\s*\"(.+?)\"/g;
var match = reg.exec( statement );
while( match != null ) {
var conditionalValue = mergeData[match[1]];
if( match[2] == "!=" ) {
if (conditionalValue == match[3]) {
conditionalString = "";
}
} else {
if (conditionalValue != match[3]) {
conditionalString = "";
}
}
match = reg.exec( statement );
}
result = result.substring(0,startTagStartPos) + conditionalString + result.substring(endTagEndPos+1)
}
Message Edited by sduda on 03-29-2007 02:23 PM
Message Edited by sduda on 04-09-2007 09:28 AM
Message Edited by sduda on 04-09-2007 09:30 AM
- sduda
- March 29, 2007
- Like
- 0
- Continue reading or reply