Are you scared of making changes to our code? Do you spent a lot of time debugging or maintaining your code? Are you new to JavaScript and do not know the language’s many pitfalls? Do you fear cross browser issues? Then you should start with Test Driven Development (TDD). Manual Testing of SAPUI5 applications is time consuming and error-prone. Since your application should run on a lot of different browsers, testing them all manually in detail is impossible. Kent Beck states that the goal of test-driven development is clean code that works. TDD not only provides fast feedback, but also improves the structure of the code.
There is already a lot of great content out there dealing with Unit Testing in JavaScript Environments. In general, you can and should apply these concepts also for developing SAPUI5 applications. Since it is always hard to start and find the most relevant information, this blog post aggregates some links to useful content:
- Start with the QUnit page and implement some smaller examples. QUnit is delivered together with SAPUI5:
- Afterwards, if you have never written Unit Tests in JavaScript before or do not know the concept of test doubles, you should have a look at Christian Johanson’s blog series:
- "The secret of testing is writing testable code" (Misco Hevery). If you are not sure how to structure your code to get it testable, read Uncle Bob’s book about clean code or watch the following video:
So start now to get out of the mess.