I am trying load a csv of User data for an Apex test from a static resource using Test.loadData(). When I upload the csv as a static resource, Salesforce gives is a MIME type of text/comma-separated-values which is not a MIME type supported by Test.loadData() ( http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_test.htm#apex_System_Test_loadData ) and so I get an error telling me as much when I run the test.

System.TypeException: Content type not allowed for Test.loadData(): text/comma-separated-values

Has anyone encountered this? Does my static resource need a MIME type of text/csv instead of text/comma-separated-values in order to use it with Test.loadData() or do I have another problem? Is there any trick to forcing this MIME type?

1 Answer 1


I can reproduce the error (which is a pretty clear anyway) so you will need to use ContentType of "text/csv".

I can think of 2 ways of getting the ContentType (labelled "MIME Type" in the UI) to be the required "text/csv":

  • Install a different browser and use that to do the uploads as AFAIK it is the browser that infers the content type from the file extension and/or file content; Chrome on a Mac uploads a CSV file with the file extension .csv as "text/csv".
  • Use the Force.com IDE or the Ant migration tools to download the static resource(s), then fix the contentType element in the .resource-meta.xml file(s), then upload them. (I used the Force IDE to turn my working "text/csv" static resource into a failing "text/comma-separated-values" one.)
  • Thanks guys this was helpful. I was able to find the MIME Type in the workbench (Info->Metadata Types & Components ->Click appropriate fold, the go to the Id -> Update -> change the content type -> Update). Apr 15, 2015 at 23:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .