Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Varu
Explorer
8,768
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
QUnit is a powerful, easy-to-use JavaScript unit testing framework. Originally developed for testing jQuery, jQuery UI, and jQuery Mobile, it is a generic framework for testing any JavaScript code. It supports client-side environments in web browsers, and server-side (e.g. Node.js).

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

Thought about testing your interaction with the app yet, for example checking if the dialog opens when we click the “Dialog” button. We can easily do this with OPA5, a feature of SAPUI5 that is easy to set up and is based on JavaScript and Quit.

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.

Behind the scenes it uses Web driver which is the same as used in Selenium and Jasmine to establish the test suite and write the tests. It’s all coded in JavaScript, so no need to learn Java or Python as you are with Selenium. Also, when using tools like Selenium you must code specifically for the delays and busy indicators, which tends to make the code quite cumbersome and very flaky. With UIveri5 this is all handled by the framework itself, like OPA5.

 

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.

 

Summary

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.

Happy Testing!

 

 

Reference:

SAPUI5 SDK: Documentation (Testing)

https://sapui5.hana.ondemand.com/#/topic/7cdee404cac441888539ed7bfe076e57

 
2 Comments
0 Kudos
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.

 

Thanks,

Saurabh

Tester
krzys
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi everybody,

please be aware that uiveri5 has been deprecated

https://github.com/SAP/ui5-uiveri5

Use WDI5 instead:

https://blogs.sap.com/2022/05/12/wdi5-release-state-of-things-outlook/

 

Christoph
Labels in this area