You need to sign in to do that
Don't have an account?

Read a static file into Unit Test
Is there a way to read in a static file into a unit test?
I am trying to unit test a large data set coming back in a JSON format from our webservice call and would like to load a sample text file for my unit tests.
The overall objective of the unit tests it to test the governor limits on batch inserting a large number of leads.
hi,
In test class put one if COndition
if(Test.isRunningTest())
{
read text file here from static redource
write the txt value in json webservice response variable
this will surely work.
}
if u like this post then put as a solution or ask me any question
That is what I want to do. Can you provide sample code of reading in a text file in Apex code? I haven't been able to find a sample anywhere ...
Sorry
We cant use Static Resource file in Apex Class.
You can use document to upload the file.