Timeline for Discovery tests failing on very simple scenarios
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 13, 2014 at 18:26 | comment | added | Chris Duncombe | That could be an edge case where it's ok. Some poeple might set up a test util class that creates all 40 of the custom settings and you can call it from your test class. You still have ti manually write the code, but you only have to write it once and you can create it all with one line of code from the test class. Its reusable as well. I think this is worthy of a new question though to get more visibility and other opinions. Please add it as a new question, and others can chime in. | |
Jan 13, 2014 at 18:22 | comment | added | kbentsen | @sfdc_ninja do you think it's okay to use SeeAllData if my main class leverages custom settings to avoid hard coded data? I've created ~40 custom setting records that I'd prefer to not have to re-create in my test class. | |
Jan 13, 2014 at 13:36 | comment | added | Chris Duncombe | No prob. Just trying to help you in the long run. Good luck. | |
Jan 13, 2014 at 13:24 | comment | added | Joe | @sfdc_ninja - thanks for the pointers. I will make sure to not use this in a real world case, but am just trying to wrap my head around syntax and usage with discovery type tests. | |
Jan 10, 2014 at 20:06 | comment | added | Chris Duncombe | I would not use SeeAllData as an alternative to get around this. It will solve the problem, but its a very bad habit to get into. Creating tests that are dependent on your org data is not a good idea. It is not best practice, I would create your own test data. Take a look here wiki.developerforce.com/page/How_to_Write_Good_Unit_Tests | |
Jan 10, 2014 at 19:52 | comment | added | Joe | Thanks! @IsTest(SeeAllData=true) is exactly what I needed. | |
Jan 10, 2014 at 19:50 | vote | accept | Joe | ||
Jan 10, 2014 at 19:34 | history | answered | PepeFloyd | CC BY-SA 3.0 |