vs-ude / mic-1-toolbox

Web-based MIC-1 emulator and toolbox
https://vs-ude.github.io/mic-1-toolbox/
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Recherche: Unit Test #24

Closed OskarCarl closed 2 years ago

OskarCarl commented 2 years ago

5 Pkt.

Wie funktionieren unit Test in Angular? Reicht das aus?

YasinKavuk commented 2 years ago

Angular component tests works by using "ng test". "ng test" builds the application in watch mode and launches the Karma test runner. Karma is a testing environment. By default you need the Chrome browser. You also might to need to set your CHROME_BIN Enviromental Variable or you might get an error.

"ng test" will than test every spec.ts files. So if someone wants to write an individual test, they would need to write it in the spec.ts file of this specific component. There is a default test that is already setup when you generate the component. The default just instantiates the component and tests if it exists or not. Services can also be tested the same way.

The tests can be configured in the karma.conf.js file.

YasinKavuk commented 2 years ago

https://testing-angular.com/target-audience/#target-audience