I know this post is related to the old router, but I thought it would be helpful to answer this question. Using the angular version of rc.1 with the new router, I got unit tests with the router, including navigateByUrl testing, using this test in angular as inspiration: https://github.com/angular/angular/blob/master/modules/%40angular/ router / test / integration_spec.ts
saved me a lot of hastle
Here is a working example
import {setBaseTestProviders,beforeEachProviders,inject,it,describe,expect,beforeEach} from '@angular/core/testing' import { Component,provide} from '@angular/core'; import {Routes,ROUTER_DIRECTIVES,Route} from "@angular/router"; import {ComponentResolver} from '@angular/core'; import {Router,RouterOutletMap,RouteSegment,RouterUrlSerializer,DefaultRouterUrlSerializer} from '@angular/router'; import {SpyLocation} from '@angular/common/testing'; import {Location} from '@angular/common'; import {ComponentFixture, TestComponentBuilder} from '@angular/compiler/testing'; import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from '@angular/platform-browser-dynamic/testing'; @Component({ selector: 'some-component', template: `Blah!`, directives: [ROUTER_DIRECTIVES] }) export class SomeComponent { } @Component({ selector: 'another-component', template: `Blah!`, directives: [ROUTER_DIRECTIVES] }) export class AnotherComponent { } @Component({ selector: 'root-cmp', template: `<router-outlet></router-outlet>`, directives: [ROUTER_DIRECTIVES] }) @Routes([ new Route({path: '/some-path',component:SomeComponent}), new Route({path: '/another-path',component:AnotherComponent}) ]) export class RootCmp { } export const PROVIDERS_TESTING = [ provide(RouterUrlSerializer, {useClass: DefaultRouterUrlSerializer}), RouterOutletMap, provide(Location, {useClass: SpyLocation}), provide(RouteSegment, {useFactory: (r) => r.routeTree.root, deps: [Router]}), provide(Router,{ useFactory: (resolver, urlParser, outletMap, location) => new Router( "RootComponent", RootCmp, resolver, urlParser, outletMap, location), deps: [ComponentResolver, RouterUrlSerializer, RouterOutletMap, Location] } ), ] setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,[TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS,PROVIDERS_TESTING]); it('some test',inject([Router, TestComponentBuilder, Location], (router:Router, tcb:TestComponentBuilder, location:Location) => { return new Promise((resolve,reject)=>{ tcb.createAsync(RootCmp).then(fixture=>{ router.navigateByUrl('/some-path').then(()=>{ expect(location.path()).toEqual('/some-path'); resolve() }) }) }) })) it('another test',inject([Router, TestComponentBuilder, Location], (router:Router, tcb:TestComponentBuilder, location:Location) => { return new Promise((resolve,reject)=>{ tcb.createAsync(RootCmp).then(fixture=>{ router.navigateByUrl('/another-path').then(()=>{ expect(location.path()).toEqual('/another-path'); resolve() }) }) }) }))