function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
zirosziros 

Test class while packaging for other orgs

Hello, we have a small application involved apex vf page a controller and some js code.

we created a test class for out controller and all went well, than we packaged it all.

when we installed the package to other org , we got errors on the test class , for example on
Account object. (it seems that the other org have testing on account too and our test isn't enought)

for the purpose of the test class we can use any object instead of accout but it's still not gaurentee us that we won't fall on those objects.
is there any Dummy object or some other way to use "our" object so it won't be conflicted with other org's test classes ?
TIA

 

Ashish_SFDCAshish_SFDC
Hi TIA, 


Need more information on this, 

Did you put the RunAllTests = true 

When you install a component that contains Apex, all unit tests for your organization are run, including the unit tests contained in the new package. If a unit test relies on a component that is initially installed as inactive, such as a workflow rule, this unit test may fail. You can select to install regardless of unit test failures.

http://help.salesforce.com/apex/HTViewHelpDoc?id=distribution_installing_packages.htm


See the doc below, 

Run-All-Tests, and difference in test execution when deploying to Sandbox vs. production

http://help.salesforce.com/apex/HTViewSolution?id=000003620&language=en_US


See th erelated discussions in the below threads,

http://salesforce.stackexchange.com/questions/19114/unable-to-deploy-code-to-sandbox-as-installed-managed-package-test-methods-are-f
http://salesforce.stackexchange.com/questions/21507/how-to-handle-installed-managed-packages-failing-tests


Regards,
Ashish