0

I have followed the trailheads for making a TestDataFactory. In the documentation it states that the TestDataFactory is a special class used for testdata. What isn't clear to me is can I change the name of this class and still use this as a Testdatafactory for example Projectdatafactory or will this make the Projectdatafactory class count against the codecoverage.

What I want to know is if the Testdatafactory class is like a naming convention for salesforce. And if so if this can bu used with a prefix in a managed package. like zz__Testdatafactory.

1 Answer 1

2

TestDataFactory The name is just good as per the naming conventions. By giving this name does not make it special.

It does not count against code character count/coverage because you add @isTest to this class.

Also, there can be scenarios where you would want to use another additional class to generate test data. In that case, you can follow this naming convention and append another word to it, like TestDataFactoryForProject or ProjectTestDataFactory.

You just need to add @isTest to all of your test factory classes.

Also, you can definitely add it in a managed package.

You must log in to answer this question.

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