Chapter 8. Testing and Profiling the Dart Code

Testing is an essential part of any development process. There are many different approaches and libraries that can be used to test your applications, and we'll take a look at one of them.

In this chapter, we'll talk about:

  • Unit testing in Dart, a very common way to test independent parts of applications that can range from single methods to entire classes
  • Operator overloading and mixins, two more features of Dart
  • A few notes about testing AngularDart apps
  • A short introduction to Observatory, Dart's built-in profiler

In contrast to the previous chapters, we won't run our code in the browser but write console applications instead.

Testing strategies for web apps

It's hard to tell what is generally the best way to test web apps. There are quite a lot of tools already and probably apart from choosing the right tool, you'll need to think about what you should test, where, and how.

We'll mostly talk about unit testing because it can be used for both web and standalone apps. Then, in the context of AngularDart, we'll mention the so-called end-to-end tests with Karma and Protractor. We're not able to cover everything in this chapter, so if you want to know more about testing in JavaScript and in the browser, take a look at the master's thesis of Vojtěch Jína, a current employee of Google, who has been working on AngularJS for more than 3 years: https://github.com/karma-runner/karma/raw/master/thesis.pdf.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.192.120