Skip to Content
Technical Articles

Running CAP Node Applications in SAP Business Application Studio

SAP Business Application Studio offers the Run Configurations tool for running and testing your  SAP Cloud Application Programming Model (CAP) applications. Using the Run Configurations tool can save you a lot of time, and improve your productivity.
In this blog, I will cover the main features of the tool. 

Creating and viewing run configurations 

The Run Configurations tool is used to create multiple run configurations for your application. It uses a simple tree view to visualize your applications’ run configurations. Each run configuration contains all the information you need to run your application. You can edit and run it directly from the tree. 

Run configurations are actually standard launch configurations.
From the context menu, you can open the ‘launch.json’ file to see how the configuration is defined. (You can also read more on Visual Studio Code launch configurations concept, that applies also for SAP Business Application Studio, here)

If you have defined profiles for your application, you can create a configuration to run with a specific profile.

The run configuration will present the relevant information for that runtime profile.

Binding dependencies

The run configuration shows all the dependencies of your application. These include remote services, databases, and OData dependencies.

Respectively, for each dependency, you can choose (a.k.a bind) the service instance, the database, or the destination of the OData service with which you’d like your application to run. (In each run configuration, you can bind to different services, destinations, etc.)

The bind action takes care of additional tasks like installing missing dependencies and deploying your data model, so that you will be able to test your application immediately after completing all the required bindings.

Note: The credentials of the bound services and destinations are saved in a dedicated ‘.env’ file for each run configuration in the root of your project.  (Make sure not to commit them to your Git repository.)

Mocking OData dependencies

CAP supports mocking OData services. Dependencies to OData services are presented in the run configuration, and with a single button, you can choose to mock them.

After you tested your application with the mocked OData service, you can turn off the mock option and bind your OData dependency to a real destination.

Summary

The Run Configurations tool offers a few features that can help you manage the testing of your application and improve your productivity. So… give it a try and let me know what you think.

Happy coding 🙂

 

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.