Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/superstar1205/angular-uint-test
Angular-Unit-Test: all are over 90% ๐. TypeScript/Karama/Jasmine/Angular/CSS/HTML5/Unit-test
https://github.com/superstar1205/angular-uint-test
angular css html jasmine testing typescript unit-testing
Last synced: 2 months ago
JSON representation
Angular-Unit-Test: all are over 90% ๐. TypeScript/Karama/Jasmine/Angular/CSS/HTML5/Unit-test
- Host: GitHub
- URL: https://github.com/superstar1205/angular-uint-test
- Owner: superstar1205
- Created: 2021-07-10T15:06:31.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-08T03:07:23.000Z (over 2 years ago)
- Last Synced: 2024-10-14T07:42:34.219Z (2 months ago)
- Topics: angular, css, html, jasmine, testing, typescript, unit-testing
- Language: TypeScript
- Homepage:
- Size: 3.29 MB
- Stars: 20
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Angular-Uint-test
#### I provided unit test and rise test result all is over 90%![Screenshot_18](https://user-images.githubusercontent.com/86986628/129895216-96ec02cb-f6e0-43e1-afff-ded514c42647.png)
## How to run tests?
By the command npm test. Your project will be compiled and run Karma for running all tests in your project. It will also open your browser (default address localhost:9876) and show the test results.### Types of automated tests.
There are 3 main types of automated tests. There are no strict borders between them and it can be arguably hard to decide which test falls in which category.#### Unit testing - test of one โunitโ of code.
It can be a class, or method, with mocked dependencies. We will use this type of test here.#### Integration testing โ Few classes testing integrated.
For example, for the back-end, it can be service and repository testing together, or service and component testing for the front-end.#### End to end testing โ full application testing
From front-end to back-end, thatโs why it is called a (front) end to (back) end testing. In these tests usually live services using and nothing is mocked. it fully reproduces the real application work.## Test tools โ Karma and Jasmine
For automated tests on the front-end with Angular often uses built-in tools Karma and jasmine. Karma is a test runner, the tool which runs our tests in the browser. Jasmine โ test tool for creating mocks and assert test results. You can use different tools for testing, such as Jest, Mocha, Chai, etc., but Jasmine already here out of the box and sufficient for most cases.## spec file for unit tests
Itโs important โ all tests should be stored in files with name format .spec.ts. File type โspecโ (stands for โspecificationโ), tells Karma that this is the file with tests.`npm install`
and then
`ng test`
# Arrange, Act, Assert (AAA)
The test is a story, it should be clear and easy to read.Arrange โ set the initial state of the system under test.
Act โ call a method that you want to test.
Assert โ Analyze the result and ensure that it equal to the desired result.Jasmine has a special function, called expect.
## Contact Link[telegram] (https://t.me/ProDev1205)
[Skype] (https://join.skype.com/invite/xAHPnMKaZkkk)