Cross posting from SO:

I’m not trying to be snarky, bu I really do think you are mis-understanding 
the purpose of the $httpBackend that is in the ngMockE2E module.

This is not a matter of opinion, the ngMockE2E module is simply not 
designed nor intended to be used from within a jasmine specification. 

When duing end-to-end testing there are two sides to the test. One is the 
angular application that is being tested, the other is the angular-scenario 
code that lives in the Jasmine Specification. 

Under E2E tests there are no angular module, or ng-mocks, or anything 
angular-related on the jasmine side of things (other than the scenario 
runner). 

The ngMocksE2E module is designed to be used on the “server” side of things 
where the actual angular application is executing. It’s main purpose is to 
enable us to pre-can responses so that integration-level UI testing can 
proceed much quicker than if each page actually went to the server for 
JSON. 

When using jasmine along with ng-mocks, angular will always replace the [image: 
httpBackend with the mock backend. When adding the `ngMocksE2E` module it 
will not be able to get ahold of any]httpBackend` and as you have already 
found out, will just wrap the mock and delegate to it on the pass-through.

It would seem that the kind of test you are trying to write is a test that 
doesn’t test the UI integration, but tests the application javascript and 
server integration. 

This is perfectly legitimate style of testing (referred to some as 
‘midwayTesting’ in the angular community). Your problem is you are using 
the wrong tool.

I would take a look at this:

https://github.com/yearofmoo/ngMidwayTester

Which you would use instead of angular-mocks and angular.module() in order 
to facilitate the kind of testing I’m assuming you want to do.

You can read more about it here:

http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html

(apologies if you have already been linked there)

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to