Choose the best Test Automation for your SAP Fiori App
Testing is one of the most critical processes of the Software Development Lifecycle (SDLC). It helps companies to perform a comprehensive assessment of software and ensure that their product fulfils the client’s needs.
The testing phases of the software development lifecycle help companies to identify all the bugs and errors in the software before the operation phase begins. If software bugs are not resolved before deployment, they can adversely affect the client’s business.
Besides that, trying to resolve these issues at a later stage can incur substantial costs. The more you delay the detection of these issues, the greater the cost you are likely to face.
In this blog post you will learn about several ways to perform automated testing of SAP Fiori apps. The techniques used for testing can vary depending on the objectives of the testing procedure.
The major real-world belief is that automated UI testing is considered unreliable and it is avoided in favour of manual tests. However, manual tests cannot be used as regression testing. Automated tests inform us immediately if a code change leads to a regression.
The ability to automate and reliably execute a core set of scenarios could make a significant difference to the quality of the product.
Image Source: SAPUI5 SDK: Documentation
Identify the options
Unit Tests: QUnit
Quit tests provide good support for asynchronous testing. These types of tests are often needed for UI functional tests, for example if you must wait until rendering is done, animations are complete, or a backend call returns. In addition, a Quit test page can be executed standalone in the browser without the need of an additional “tool”. This makes the creation and execution of single QUnit tests much easier. Finally, QUnit is closely related to jQuery, which is also a fundamental part of SAPUI5.
Component/Integration Tests: OPA
OPA (One Page Acceptance Tests) is an SAPUI5 package for writing integration tests. It’s modelled as Quit plugin that loads and test the application. It hides asynchronicity using polling mechanism and eases access to SAPUI5 elements. This ensures clean and readable tests
limitations of OPA:
• Screen capturing
• Remote test execution
• End-to-end tests are not recommended with OPA due to authentication issues
and fragility of test data
System Tests: UIVeri5
UIVeri5 is an E2E testing framework for UI5-based applications. It uses WebDriverJS to drive a real browser and interacts with your application as a real user would. UIVeri5 is heavily inspired by Protractor and brings most (and more) of its benefits to UI5 applications.
Analyze the decision criteria
Do you need to verify that your software module (unit) behave as expected?
Choose QUnit when you want to test individual units of your application.
An Application is build-up of modules (unit). Unit is a function that can tested outside the application, for example formatter that rounds price up or down to display 2 digits behind decimal separator. These types of tests are often needed for test driven software development.
Is it critical to test the application in a way how user would interact with it?
Choose OPA5 when you want to test interaction patterns or more visual features of our app i.e. pure UI functionality.
Do you need to have test driven development approach?
Test Driven Development TDD is a software development model that relies on a very short development cycle. When using TDD a developer first writes a failing automatic test case to describe the behaviour of a new feature or functionality. As soon as the test fails (due to the still missing implementation) the role of the developer switches to the implementation. The code is added to make the test run successful and then the cycle starts over again.
You can Choose QUnit or OPA for TDD. It further depends on whether you want to test individual units of your application or pure UI functionality.
Using integration and unit tests and running them consistently in a continuous integration (CI) environment, we can make sure that we don’t accidentally break our app or introduce logical errors in existing code.
If you want to test: crucial workflows, ensure the pieces work together, and exercise the whole system (integration of front end and back end)
Choose UiVeri5 as it helps simulating the real user scenarios.
Test automations save time, reduce cost and maintenance, increase the test coverage, reduce recurring manual efforts, helps in getting faster feedback and increases the development efficiency. I hope that this blog post is helpful to you in choosing the right test automation for your application.
If you have anything that you would like to share, please add in comments section below.
SAPUI5 SDK: Documentation (Testing)
Hey Karan, really informative scenario. We are planning on going with Qunit as unit test framework, however we are not sure on how to test event control functions.. Most of them are event driven only.. If you have any sample code or anything other than sap hana on demand url where all things are placed, it would be great if you guide us. We are stuck and not finding a ray of hope from long time now.
please be aware that uiveri5 has been deprecated
Use WDI5 instead: