Collapse
Submit a Service Request
Contact Information for Technical Support
My Service Notifications
We have not changed the code within a CPM, but now the results of Process Designer tests are different than before.
Answer ID 12914 |
Last Review Date 10/16/2024
Why are the results of Process Designer tests different than before, when we have made no changes to the CPM code?
Environment:
Service Process Model (SPM), Process Designer, Custom Processes (CPM)
Oracle B2C Service
Oracle B2C Service
Issue:
I have not changed the code for a CPM, which has been deployed to our production site and has been working for several months. Now, when I test the same code in the Process Designer, the test result is different. How could this be the case?
Resolution:
Tests from the Process Designer use what is called a "test harness class". This sets up objects used for the test from the Process Designer, and the detail added to this custom code within a CPM can be detailed to cover all aspects of the main CPM class, and can also be coded in a way that tests nothing. The objects established by the test harness class are sometimes created within the CPM code, and are sometimes fetched instead.
The most-common cause of the behavior asked about, is when the test harness class references existing objects vs. creating them. Differences are typically encountered when testing between different sites (such as when deploying code written and tested on a test site to production). The reason is typically that the objects referenced in the test harness code do not exist in the other site.
Otherwise, differences will be explained by the state of the site in reference to the test harness class and the main CPM code. In short, anything that causes the path the code takes when the CPM test is run, can change the results. This could be a single conditional if statement within code that is the result of a ROQL query, for example. In this example, if the PHP if statement evaluates as true when previously (in a previous test of the same code from the Process Designer two weeks ago, for example) it evaluated to false, then the result of the test will likely be different.
Thus, with a typical CPM customization containing many such conditionals, it is easy for code to be skipped in a Process Designer test, where it is not tested at all. Any such differences between sites (or the same site over time) might cause code that was previously not run in a Process Designer test to be run in a subsequent test (thus testing it when it was not tested before). The opposite can be true also. Again, anything that causes the code to run differently during the test, can cause differences in the test results. If it is required to know what such a difference is, then troubleshooting using custom logging etc. will likely be required to make such a determination. For further details on this see