Testing AngularJS';s$httpBackend-如何配置?

Testing AngularJS';s$httpBackend-如何配置?,testing,angularjs,angular-scenario,Testing,Angularjs,Angular Scenario,我正在制作一个angular应用程序,并在其上运行端到端测试。我需要为我的一些测试运行一个$httpBackend实例,但我不知道怎么做。目前我的代码看起来像 myApp = angular.module('myApp', []); myApp.controller('Controller', function () { $http.post('/register/reg').success(function () console.log('yay');); \\ things... m

我正在制作一个angular应用程序,并在其上运行端到端测试。我需要为我的一些测试运行一个
$httpBackend
实例,但我不知道怎么做。目前我的代码看起来像

myApp = angular.module('myApp', []);
myApp.controller('Controller', function () {
    $http.post('/register/reg').success(function () console.log('yay'););
\\ things...
myTestingApp = angular.module('myTestingApp', ['myApp', 'ngMockE2E']);
myTestingApp.run(function ($httpBackend) {
    $httpBackend.whenPOST('/\/register\/reg.*/').respond(200);
});

然后我只需导航到
runner.html
并运行测试。我的所有其他测试都被业力看到,但事实并非如此。发生了什么事?

它是否在runner.html下工作?如果没有,您是否使用myTestingApp模块引导应用程序,即ng app=“myTestingApp”?@KarlZilles我正在引导,是的。不过它也在runner.html上运行。