We noticed, that we still need to implement the feature file tests. Besides that, we decided that we want to write some unit tests.
To write feature file tests in Angular, we need the Protractor –Cucumber framework. This plugin makes it possible to run cucumber tests using Protractor. Protractor is an end-to-end test framework for Angular applications. It runs tests against the application running in a real web browser, interacting with it as a real user would do.
The unit tests for Ionic/Angular are usually implemented with Jasmine and Karma.
Jasmine is a modern Behavior Driven test framework for JavaScript projects. The pros of this framework are that it doesn’t need a web browser or any DOM and it has an “easy-to-read”-syntax.
Karma, however, isn’t a testing framework, it’s a test runner. That means, it can run test code in multiple real web browsers. Which test framework you use doesn’t matter. There are already plugins for most of the common testing frameworks: Jasmine, Mocha, QUnit, and many others. That is a big pro for Karma.
So, we want to use Karma to run our jasmine test files.
Because we set up our frontend-project with the Ionic/Angular CLI, all empty Jasmine test files have been generated automatically and the test frameworks were installed and configured correctly. So, it is possible to execute these tests directly after the project was set up. Our only job here is to write the tests and we think that is cool. That saves a lot of time.
We have many things to do for this week. We don’t have anything to show just yet because we need additional time to implement these tests but make sure to check our next post where we will provide some working demos.
In the meantime, make sure to check out all the details about our backend testing that Gino has already written about:
- Test-Driven Development (TDD) in ASP.NET Core
- Let’s Have Some Fun with Load Testing
- Enhance Your CI/CD Pipeline with Automated API Tests
Also, check out the testing stage in our CI/CD pipeline.
Cheers and stay safe,
Isi
3 replies on “Testing, Testing, Testing”
Hi,
I like that you’ve gone into more detail about how and how you test. Also, I like the links for additional information.
I just miss the links to your tests. It would be great if you could add them.
In the Grading Criteria, it says that you need a link to your test plan. You should add this link.
Greetings
Manuel@Orchestra
Hi Manuel,
thank you for your heads up. We’ve been working on some tests but faced some troubles with Angular and Cucumber along the way. Working on fixing these; we’ll make sure to amend this in the next post.
Hey Team Foodies,
I like the idea of using karma for your e2e tests as we are also using Angular with karma and the cucumber tests. I am looking forward to see your implementation of that, feel free to notify us once you update your post 🙂
Leonhard – GameBase