Show TOC

TestingLocate this document in the navigation structure

The templates include basic testing features, unit tests as well as integration tests for a basic test coverage of the initial app. The tests are written independently of the actual data displayed in the app.

The webapp folder of the template app contains a test.html file which serves as an overview for the different test pages. You can run the app with or without mock data and run the unit and integration tests. This section describes which application tests are provided and how they are structured.

Integration Tests
The integration tests shipped with the template cover all basic functionality and provide several "journeys". Journeys include a series of OPA tests that belong to the same functionality and should be executed together. Some of the journeys are implemented for both phone and desktop use cases to test device-specific interaction steps:
  • BusyJourney / BusyJourneyPhone: This journey tests the busy indication features of the app for phone and other devices.

  • NavigationJourney / NavigationJourneyPhone: This journey will trigger user interactions and navigate through the application. The routing configuration, basic navigation events, and error handling are tested here.

  • NotFoundJourney: Several "not found" cases of the application are tested here. Faulty navigation scenarios are introduced intentionally to simulate errors.

  • MasterJourney: Tests for the Master page that check the search, sorting, filtering and grouping features built into the app.

  • FLPIntegrationJourney: This journey is available if you have enabled SAP Fiori launchpad (FLP) for your app. It tests the FLP integration features Save as tile and Share on SAP Jam.

  • AllJourneys: This is a convenience journey that will call all the other journeys specified above and is used in the test suite file.

You can execute all journeys by calling the test suite file opaTests.qunit.html or opaTestsPhone.qunit.html in the webapp/test/integration folder or selecting the run all integration tests link in the test.html file in the app’s root folder.

For more information, see Integration Testing with One Page Acceptance Tests (OPA5) and sap.ui.test.Opa5 in the Explored app within the Demo Kit.

Unit Tests

In the unit subfolder you can find all unit tests for our application. They are structured similarly to the structure of the webapp folder. For example, controller tests are located in the controller folder whereas formatter tests are located in the model folder.

Unit tests are included for the following functionality:

  • App controller tests
  • ListSelector tests
  • Formatters
  • Groupers
  • Device model

As with the integration tests, you can execute all unit tests by calling the test suite file unitTests.qunit.html in the webapp/test/unit folder or selecting the run all unit tests link in the test.html file in the app’s root folder.

For more information, see QUnit Testing Fundamentals, published on non-SAP site and published on non-SAP site.