Setup for Local Testing in Eclipse
Wouldn’t it be nice to get instant feedback if your application still works after each change? Having the correct setup of your development environment, this can be easily achieved. With local testing, you get instant feedback after each change and can execute your unit test and your local test page before committing your changes to the repository. There are some pitfalls regarding local testing in Eclipse. This post provides an overview and links for more information.
- You can either use Tomcat or the WebAppPreview for local testing.
- Pitfall 1: SAPUI5 Version used for local testing is too old.
- By default, the runtime libraries from the Eclipse plugins are used. (You can find out their versions under Preferences/SAPUI5). There is, however, a different solution: Either you update your Eclipse installation, which also automatically updates SAPUI5, or you configure the resource servlet. For more information about the configuration of the resource servlet, see:
- Pitfall 2: Tomcat caches your files and does not consider changes
- Enable Serve modules without publishing in the Tomcat web.xml. Otherwise, when you change a web resource in META-INF/resources in a library module, this change will not directly be visible in the running application after reloading the current page in the browser.
- Pitfall 3: Browser caches your files and does not consider changes
- You could adjust the browser settings. For Chrome there is a setting in the Chrome developer tools, which disables caching while the developer tool is open. For more information, see: https://developers.google.com/chrome-developer-tools/docs/settings
- A better alternative is to disable caching in the resource servlet. SAPUI5 provides a ResourceServletweb.xml. To disable caching, open the web.xml file located in the <WebContent folder name>/WEB-INFcom.sap.ui5.resource and change the parameter com.sap.ui5.resource.DEV_MODE to true.