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 haven׳t specified explicit profiles for your application, you can create a run configuration that uses the development profile, which is the default runtime profile. If you have defined additional profiles ( i.e. production), you can create a configuration to run with these specific profiles.
The run configuration will present the relevant information for that runtime profile.
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.
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.
To learn more on SAP Business Application Studio refer to info blog II
Happy coding 🙂