How To Fix CDS_UNIT_MESSAGE035 - Creation of test doubles is not permitted for &1


SAP Error Message - Details

  • Message type: E = Error

  • Message class: CDS_UNIT_MESSAGE - Message Class

  • Message number: 035

  • Message text: Creation of test doubles is not permitted for &1

  • Show details Hide details


  • Self-Explanatory Message

    Since SAP believes that this specific error message is 'self-explanatory,' no more information has been given.The majority of messages in the SAP system have a message text, however this is frequently insufficient to comprehend or resolve the problem.

    To make things easier, more detailed information is frequently added to describe the issue, how to fix it, and the necessary steps or configuration modifications.

    Unfortunately, there isn't any extra information in this error notice.



    What else can you do?

    First, use our AnswerBot below to get a possible cause and solution (requires a premium subscription).

    Also, review the in-depth Common Questions & Answers listed below; you could discover a solution there or be able to connect with others who have faced similar challenges.

    You can also try searching the SAP support portal (support.sap.com) but you need a special user ID to access it. It is possible that an SAP support note exists that provides additional details about the mistake or even steps for fixing it.


Smart SAP Assistant

  • What is the cause and solution for SAP error message CDS_UNIT_MESSAGE035 - Creation of test doubles is not permitted for &1 ?

    The SAP error message CDS_UNIT_MESSAGE035, which states "Creation of test doubles is not permitted for &1," typically occurs in the context of Core Data Services (CDS) and ABAP Unit testing. This error indicates that the system is trying to create a test double (a mock or stub) for a CDS view or entity that does not allow it.

    Cause:

    The primary cause of this error is that the CDS view or entity you are trying to test is not designed to support test doubles. This can happen for several reasons:

    1. Non-Deterministic Behavior: The CDS view may have non-deterministic behavior or dependencies on database state that cannot be easily mocked.
    2. Complex Logic: The logic within the CDS view may be too complex or involve database operations that are not suitable for unit testing.
    3. Restrictions in CDS: Certain CDS features or annotations may restrict the ability to create test doubles.

    Solution:

    To resolve this error, consider the following approaches:

    1. Refactor the Code: If possible, refactor the logic in your CDS view to make it more testable. This might involve breaking down complex views into simpler components that can be tested individually.

    2. Use Integration Tests: Instead of unit tests with test doubles, consider using integration tests that run against a real database. This way, you can validate the behavior of the CDS view without needing to create test doubles.

    3. Check Annotations: Review the annotations used in your CDS view. Some annotations may prevent the creation of test doubles. Ensure that the view is designed with testability in mind.

    4. Mocking Alternatives: If you need to test the logic that depends on the CDS view, consider mocking the service or class that consumes the CDS view instead of the view itself.

    5. Consult Documentation: Refer to the SAP documentation for any specific guidelines or limitations regarding unit testing with CDS views.

    Related Information:

    • ABAP Unit Testing: Familiarize yourself with the principles of ABAP unit testing and how to structure your tests effectively.
    • CDS Views: Understand the capabilities and limitations of CDS views in SAP, including how they interact with the database and their intended use cases.
    • SAP Community: Engage with the SAP Community or forums for insights from other developers who may have encountered similar issues.

    By following these steps, you should be able to address the CDS_UNIT_MESSAGE035 error and improve the testability of your CDS views.

    • Do you have any question about this error?


      Upgrade now to chat with this error.


Instant HelpGet instant SAP help. Start your 7-day free trial now.


Related SAP Error Messages

Click the links below to see the following related messages:

Click on this link to search all SAP messages.


Rating
The AI Support Assistant is great. It provides comprehensive assistance even on the most difficult issues. I highly recommend this service.
Rate 1
John Jordan
SAP Consultant & Author