How should I approach testing in ember?

new for javascript and ember, and I have not tested this application before. I use jasmine and sine so far.

I built unit tests for models for my ember application and it was simple. as soon as I got to the controllers, I ran into problems. I did not define a Router for the test application, since I was only a testing module. however, when I add a test for the controller, Ember.Application.registerInjection is called (I understand that this is part of the automated Ember process with the router), but it throws an error due to the lack of a router definition.

If I define a minimal router, ember tells me that I should have an ApplicationView or application template defined in my application. I understand it.

If I just want to run unit tests, it seems that defining and rendering all the views of my regular application in the browser will be terribly slow as the tests accumulate. I also understand that I need to check my views at some point.

therefore it makes me ask:

How can I efficiently run my unit tests independent of presentation level?

How can I perform integration testing when viewing views?

I read about headless testing, but I don’t quite understand how to do this, or what I should use. I would like to stick with jasmine, if possible.

general approaches, specific advice will be especially helpful.

+4
source share
1 answer

My approach to unit test models and integration is checked by the rest. In general, unit testing of something outside of the models becomes difficult, as there is a lot of interaction. In the end, you want to test the behavior of your application as a whole, so I'm fine with integration testing.

+3
source

Source: https://habr.com/ru/post/1442990/


All Articles