A testbed is a platform for experimentation of large development projects. Testbeds allow for rigorous, transparent, and replicable testing of new technologies or code in an isolated environment.
Questions tagged [testbed]
157 questions
2
votes
2 answers
unit testing gae with login setting in app.yaml
I'm unit testing a google app engine app that uses the login setting in the app.yaml file. E.g.,
- url: /profile
script: main.py
login: required
I'm using testbed, nose, nose-gae, and webtest though not sure which of those matter.
My problem…

new name
- 15,861
- 19
- 68
- 114
2
votes
0 answers
Newly generated Angular Component and Unit Test fails with Jest Test Runner only when using Testbed
My goal is to create a unit test using the Testbed provided by Angular Core. I happen to be using Jest Test Runner (syntax similar to Jasmine) for my unit testing.
Expected:
I expected that after the CLI generates a component and its associated…

imnickvaughn
- 2,774
- 9
- 25
- 42
2
votes
2 answers
Correct using of TestBed in Angular
in an app project based on Angular 8.1.2 and Ionic 4 I wrote unit tests for a simple class in typescript. That worked with "npm test" fine. To prepare for more complex classes with needed mocking I changed the code to use the beforeEach method and…

Andreas
- 25
- 1
- 3
2
votes
1 answer
Angular testbed testing route cannot find module
I am trying to test a simple redirect using TestBed but keep seeing the following error:
Error: Uncaught (in promise): Error: Cannot find module ./pages/login/login.module#LoginPageModule
My test is as follows:
describe('AppComponent', () => {
…

Jeremy Thomas
- 6,240
- 9
- 47
- 92
2
votes
1 answer
TestBed mocking service
I got component to test with method:
switchDocumentLanguage(lang, formData):any {
if (lang === this.currentLang) {
return null;
}
if (formData.invalid && this.currentLang === this.appConfig.defaultLanguage ||
…

Андрей Ефременков
- 69
- 7
2
votes
1 answer
Jasmine doesn't recognize Angular's DomSanitizer
I am unit testing an Angular 5 app with Jasmine. I got to the point where I need to test a function that relies on the DomSanitizer:
loadImage() {
this.image = this.sanitizer.bypassSecurityTrustStyle(`url(${this.assetUrl})`);
}
I verified that…

Alex Verzea
- 421
- 1
- 11
- 30
2
votes
2 answers
Angular2+ testcase shows No provider for NgControl
I am trying to test an angular component which has quite a lot of dependencies. But the test case expect(component).toBeTruthy(); fails with the Error: No Provider for NgControl. The full error message is the following:
Chrome 66.0.3359 (Mac OS X…

Marco Papula
- 741
- 2
- 8
- 18
2
votes
2 answers
Unit testing (?) an angular 6 component with TestBed
When using the TestBed, are you really unit testing a component or are you making integration tests?
Creating a fixture (TestBed.createComponent(AppComponent)) and calling fixture.detectChanges() automatically calls ngOnInit. If you want to test…

Maxime Dupré
- 5,319
- 7
- 38
- 72
2
votes
1 answer
: could not find an object to spy upon for login() - Angular TestBed
I am trying to write a unit test for one of the components named Login.Component.ts whose code is given below. I tried various approaches but unable to get a successful response. Before explaining the component and service code, I want to know –…

a p
- 1,121
- 6
- 26
- 51
2
votes
1 answer
debugElement return null in my angular5 test
I wish to test an anguar5 component using a host component as described in angular.io doc.
But my test keep failing because of
TypeError: Cannot read property 'query' of null
at UserContext.…

GPif
- 543
- 2
- 6
- 22
2
votes
2 answers
Async test does go trough all functions
When i try to run a test in karma jasmine it should go trough 2 services.
However it does all the way to the last function but it does not come back with its return values.
Does anyone has a idea how it does not return something?
My beforeEach
…

Dylan Gomes
- 173
- 12
2
votes
1 answer
Test services with real backend in angular
I want to test a service, which calls a real backend url and can not find the solution for it. My service has to call data from server and I want to be sure, that the data comes to the service and the service handle it right.
So here is just a…

Andrej Tihonov
- 649
- 2
- 9
- 21
2
votes
2 answers
Display issue without css with ng test Angular 4 Karma-Jasmine
I have display issue when running the command ng test. It seems I don't have css effect anymore.Here are two images one from the ng serve and the other from ng test
Is this a normal behavior ? Should I share specific files from my project Just…

Melchia
- 22,578
- 22
- 103
- 117
2
votes
1 answer
Testing component with MdDialogRef injected is calling service
I'm having a problem with testing a component having MdDialogRef and a service injected. I'd like to test that this component is calling the injected service. The problem is that I can't retrieve the service with the usual
fixture =…

seawave_23
- 1,169
- 2
- 12
- 23
2
votes
0 answers
Angular2: Better way of creating dynamic testing module
in our angular2 application we have create a few modules. e.g. appModule, componentModule etc. appModule is our top level module.
While writing our unit test we are create TestBed where we provide individual components as we need. This makes our…

TypeScripter
- 879
- 2
- 10
- 23