Timeline for Writing test code for batch operations where the CreatedDate must be in the past [duplicate]
Current License: CC BY-SA 3.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 24, 2013 at 16:17 | vote | accept | Robert Harper | ||
Dec 23, 2013 at 21:25 | comment | added | Robert Harper | Mike, the problem is that the queries are important to selecting the records that need to be worked on. The feature is to find orphaned, or soon to be orphaned records that have been stored. One of the problems is that there is a Master record-link table-multiple child dependency and the first selection is based on the creation date. I may be able to change the amount of time something has to be old before it is deleted. I'll try that so instead of more than 24 hours, it will be seconds or milliseconds. | |
Dec 23, 2013 at 21:24 | history | closed |
Mike Chale Peter Knolle Jesse Altman Samuel De Rycke eyescream |
Duplicate of Unit testing code which has logic around the CreatedDate | |
Dec 23, 2013 at 17:37 | answer | added | sfdcfox♦ | timeline score: 2 | |
Dec 23, 2013 at 17:35 | comment | added | Mike Chale | Can you refactor the code so that you can test the logic without running the whole batch? That way you might not have to persist the objects. | |
Dec 23, 2013 at 17:31 | answer | added | Andrew Fawcett | timeline score: 1 | |
Dec 23, 2013 at 16:56 | comment | added | Robert Harper | I understand that I could use JSON to create an object in memory with a specified CreatedDate. The problem is that I need multiple queries to work and I don't know how to get past the read only attribute on the CreatedDate for an object. I also understand that I can create branches around the queries when the system is in Test mode but the queries are still not tested fully and it is very important they work correctly. | |
Dec 23, 2013 at 16:34 | comment | added | Robert Harper | It is kind of a duplicate but I have to persist the objects so that the queries will work. It looks like I can create objects in memory but they still won't insert so that the queries can retrieve the data. | |
Dec 23, 2013 at 16:34 | comment | added | Matt and Neil |
System.Json.deserialize() is a nice trick here
|
|
Dec 23, 2013 at 16:14 | review | Close votes | |||
Dec 23, 2013 at 21:24 | |||||
Dec 23, 2013 at 15:53 | history | asked | Robert Harper | CC BY-SA 3.0 |