Skip to Content

Install a Mock Server in the SAP BTP, Cloud Foundry Runtime

This tutorial shows you how to install a mock server using SAP Business Application Studio and how to create a destination to the mock server in your SAP BTP subaccount.
You will learn
  • How to install a mock server in the SAP BTP, Cloud Foundry runtime.
  • How to create a destination to the mock server in the same subaccount.
slavipandeSvetoslav PandelievAugust 27, 2025
Created by
slavipande
June 17, 2024
Contributors
slavipande

Prerequisites

  • You have an enterprise global account in SAP BTP. To use services for free, you can sign up for an SAP BTPEA (SAP BTP Enterprise Agreement) or a Pay-As-You-Go for SAP BTP global account and use the free tier services only. See Using Free Service Plans.
  • You have a platform user. See User and Member Management.
  • You’re an administrator of the global account in SAP BTP.
  • You have a subaccount in SAP BTP to deploy the services and applications.
  • You have one of the following browsers that are supported for working in SAP Business Application Studio:
    • Mozilla Firefox
    • Google Chrome
    • Microsoft Edge

This tutorial follows the guidance provided in the SAP BTP Developer’s Guide.

  • Step 1

    If you don’t have access to an SAP back end system (SAP ECC, SAP S/4HANA Cloud or an SAP on-premise system) but still need OData services with some data, you can use this mock server application. It contains entities of SAP OData services with sample data.

    You need to:

    1. Install the mock server using SAP Business Application Studio.

    2. Create a destination to the mock server in the same subaccount in SAP BTP.

    The installation of the mock server is only needed if you want to test an application deployed in the SAP BTP, Cloud Foundry runtime. For local development testing, you can use the local mock server.

  • Step 2
    1. In SAP Business Application Studio, go to your IncidentManagement dev space.

      Make sure the IncidentManagement dev space is in status RUNNING.

    2. Choose the burger menu and choose TerminalNew Terminal.

      Terminal
    3. Navigate to the projects folder:

      • From the root directory run cd projects in the terminal.

      • From the incident-management folder run cd .. in the terminal.

    4. Clone the mock server GitHub repository:

      bash
      Copy
      git clone -b mock https://github.com/SAP-samples/cloud-extension-ecc-business-process.git
      
    5. In the menu, choose FileOpen Folder….

    6. Type /home/user/projects/ in the field and select cloud-extension-ecc-business-process. Choose OK to open the project in SAP Business Application Studio.

      Choose mock app folder
  • Step 3

    In the SAP BTP cockpit:

    1. Navigate to your subaccount and choose Overview.

    2. Copy the values from the Org Name and API Endpoint parameters in a text editor of your choice.

    3. In the left-hand navigation, choose Cloud FoundrySpaces, copy the space name, and write it in a text editor of your choice.

    In SAP Business Application Studio:

    1. Invoke the Command Palette - ViewCommand Palette or Command + Shift + P for macOS / Ctrl + Shift + P for Windows.

    2. Search for CF Login and select CF: Login to Cloud Foundry.

    3. Enter the Cloud Foundry API endpoint that you’ve copied from the SAP BTP cockpit or take the default API endpoint that is suggested.

    4. When prompted, enter the e-mail and password for your global account in SAP BTP.

    5. Select the Cloud Foundry org. that you’ve copied from the SAP BTP cockpit.

    6. Select the Cloud Foundry space that you’ve copied from the SAP BTP cockpit.

    7. Once you’ve selected the org. and the space, open a new terminal in SAP Business Application Studio and log in with cf login.

    You have successfully created a workspace and connected it to your desired Cloud Foundry org. and sSpace.

  • Step 4
    1. In the project folder, right-click on the mta.yaml file and choose Build MTA Project.

      When the project is built successfully, you see a new mta_archives folder in your project with the Mockserver_1.0.0.mtar file inside.

    2. Right-click on the mta_archives/Mockserver_1.0.0.mtar file and choose Deploy MTA Archive.

    Now, you need to create a destination to the mock server.

  • Step 5
    1. In the SAP BTP cockpit, go to your subaccount and navigate to the space where you’ve deployed the mock server. In the Applications section, choose the mock-srv application.

    2. In the application overview screen, copy the value of the Application Route of the mock server.

    3. Go back to the SAP BTP cockpit, navigate to your subaccount overview, and choose ConnectivityDestination. Then, choose Create Destination.

    4. Enter the following values:

      • Name = your-destination-name
      • Type = HTTP
      • URL = The application route of the mock server
      • Proxy Type = Internet
      • Authentication = NoAuthentication
    5. Select the Use default JDK truststore checkbox.

    6. Save your settings.

    7. Choose Check Connection. You get a 200 OK message.

      Destination Configuration
  • Step 6
    1. Paste the application route that you’ve copied in the address bar of the browser.

    2. Verify that there are a few API endpoints that display data.

      Mock server endpoints

    What is the response code showing a successfull connection to the mock server?

Back to top