SlideShare a Scribd company logo
ngular Testing
Islamic Azad University, Najafabad Branch
Faculty of Computer Engineering
SeyedKourosh Sajjadi
October, 2020
Jasmine
+ ARMA
24.10.20 Your name here (insert->page number) 2
Contents
●
1. Introduction
●
2. Theoretical section
– 2.1 Karma
– 2.2 Jasmine
●
2.2.a Test suites
●
2.2.b Test cases
●
2.2.c Expectations
●
2.2.c Matchers
●
2.2.d Spies
●
4. Practice
●
5. Suggested reading
●
6. References
24.10.20 Your name here (insert->page number) 3
Introduction
Why Test ?
●
As features and codebases grow, manual QA becomes more
expensive, time consuming, and error prone.
●
We test our code is to verify that it behaves as we expect it to.
●
Tests are the best way to prevent software defects.
●
As a result of this process you'll find you have better feature
documentation for yourself.
24.10.20 Your name here (insert->page number) 4
Karma
What is Karma ?
●
Karma is a direct product of the AngularJS team.
●
Karma is the default test runner for applications created with the
Angular CLI.
●
Karma provides you options to replace Jasmine with other
testing frameworks such as Mocha and Qunit.
●
your typical interaction with Karma will be to run ng test.
24.10.20 Your name here (insert->page number) 5
Jasmine
What is Jasmine ?
●
Jasmine is a behavior-driven development framework for testing
JavaScript code that plays very well with Karma.
●
Similar to Karma, it’s also the recommended testing framework
as it’s setup for you with the Angular CLI.
24.10.20 Your name here (insert->page number) 6
Test Suites
Suite
●
Begins with Jasmine function describe.
– Takes two parameters:
●
string – a name or title for what is being tested
●
function – block of code that implements the suit
24.10.20 Your name here (insert->page number) 7
Test Cases
Spec
●
Begins with Jasmine function it.
– Takes two parameters:
●
string – title of the spec
●
function – the spec, or the test case
24.10.20 Your name here (insert->page number) 8
Expectations
Expectations
●
Buit with function expect.
– Takes the actual value.
●
Is chained with a matcher function.
– Takes the expected value.
Eg. expect(actualValue).toEqual(expectedValue);
24.10.20 Your name here (insert->page number) 9
Matchers
Matchers
●
Implements a boolean comparison between the actual value
and the expected value.
●
Resposible for reporting Jasmine if expectation is true or false.
Eg. excpect(a).not.toBe(null);
24.10.20 Your name here (insert->page number) 10
Practice
24.10.20 Your name here (insert->page number) 11
Suggested Reading
●
BDD: https://blog.testlodge.com/what-is-bdd/
●
Angular Testing: https://angular.io/guide/testing#setup
●
Jasmine: https://jasmine.github.io/
24.10.20 Your name here (insert->page number) 12
References
●
https://www.slideshare.net/rai200890/angular-testing-45106036
?qid=bbd9f6c9-aaa5-4bfb-a5df-c27968c30bc2&v=&b=&from_s
earch=1
●
https://www.digitalocean.com/community/tutorials/testing-angula
r-with-jasmine-and-karma-part-1
●
https://www.positronx.io/angular-unit-testing-application-with-jas
mine-karma/
●
https://jasmine.github.io/tutorials/your_first_suite

More Related Content

What's hot (20)

PPTX
Sprinting with Anypoint Runtime Fabric
AaronLieberman5
 
PPTX
테스트자동화와 TDD
Sunghyouk Bae
 
PDF
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
Yevgeniy Brikman
 
PPTX
Test api
Ivo Manolov
 
PPTX
Qualidade de software - Gestão de Projetos de Software - BSI
Monnalisa Medeiros
 
DOC
Lesson 4...Bug Life Cycle
bhushan Nehete
 
ODP
API Testing With Katalon Studio
Knoldus Inc.
 
PPTX
AWS CloudWatch
Kasia Przybylska
 
PPT
Automated Testing vs Manual Testing
didev
 
PPTX
NUnit Features Presentation
Shir Brass
 
PDF
Cross-Browser-Testing with Protractor & Browserstack
Leo Lindhorst
 
PDF
30 testing interview questions for experienced
dilipambhore
 
PDF
[기본과정] 코드 테스트와 커버리지 기본 교육(개념)
SangIn Choung
 
PDF
Unit testing - An introduction
Alejandro Claro Mosqueda
 
PPTX
AWS Introduction
Dimosthenis Botsaris
 
PDF
(애자일) 테스트 계획서 샘플
SangIn Choung
 
PDF
A Comparative Guide to Automation and Manual Testing.pdf
kalichargn70th171
 
PPTX
Jasmine framework
Vishwanath KC
 
PDF
Building a Test Automation Strategy for Success
Lee Barnes
 
PDF
How to Automate API Testing
Bruno Pedro
 
Sprinting with Anypoint Runtime Fabric
AaronLieberman5
 
테스트자동화와 TDD
Sunghyouk Bae
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
Yevgeniy Brikman
 
Test api
Ivo Manolov
 
Qualidade de software - Gestão de Projetos de Software - BSI
Monnalisa Medeiros
 
Lesson 4...Bug Life Cycle
bhushan Nehete
 
API Testing With Katalon Studio
Knoldus Inc.
 
AWS CloudWatch
Kasia Przybylska
 
Automated Testing vs Manual Testing
didev
 
NUnit Features Presentation
Shir Brass
 
Cross-Browser-Testing with Protractor & Browserstack
Leo Lindhorst
 
30 testing interview questions for experienced
dilipambhore
 
[기본과정] 코드 테스트와 커버리지 기본 교육(개념)
SangIn Choung
 
Unit testing - An introduction
Alejandro Claro Mosqueda
 
AWS Introduction
Dimosthenis Botsaris
 
(애자일) 테스트 계획서 샘플
SangIn Choung
 
A Comparative Guide to Automation and Manual Testing.pdf
kalichargn70th171
 
Jasmine framework
Vishwanath KC
 
Building a Test Automation Strategy for Success
Lee Barnes
 
How to Automate API Testing
Bruno Pedro
 

Similar to Angular Testing (20)

PPT
Testing in AngularJS
Peter Drinnan
 
PPTX
Unit testing in JavaScript with Jasmine and Karma
Andrey Kolodnitsky
 
ODP
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
PDF
Angular Application Testing
Troy Miles
 
PPTX
Slaven tomac unit testing in angular js
Slaven Tomac
 
PPTX
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Samyak Bhalerao
 
PDF
JavaScript Unit Testing with an Angular 5.x Use Case 101
Hazem Saleh
 
PDF
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
PPTX
Angular Unit Testing
Avi Engelshtein
 
PDF
AngularJS Unit Test
Chiew Carol
 
PDF
An Introduction To Testing In AngularJS Applications
Rohan Chandane
 
PDF
What the HTML? - The Holy Grail
James Ford
 
PDF
JavaScript TDD with Jasmine and Karma
Christopher Bartling
 
PDF
AngularJS Unit Testing w/Karma and Jasmine
foxp2code
 
PPTX
Angular Unit Test
Michael Haberman
 
PDF
Angular testing
Raissa Ferreira
 
PDF
AngularJS Development Services
Kretoss Technology
 
PDF
Testing Angular apps_ A complete guide for developers.pdf
Peerbits
 
PDF
Angularjs - Unit testing introduction
Nir Kaufman
 
PDF
Front end unit testing using jasmine
Gil Fink
 
Testing in AngularJS
Peter Drinnan
 
Unit testing in JavaScript with Jasmine and Karma
Andrey Kolodnitsky
 
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Angular Application Testing
Troy Miles
 
Slaven tomac unit testing in angular js
Slaven Tomac
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Samyak Bhalerao
 
JavaScript Unit Testing with an Angular 5.x Use Case 101
Hazem Saleh
 
JavaCro'14 - Unit testing in AngularJS – Slaven Tomac
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Angular Unit Testing
Avi Engelshtein
 
AngularJS Unit Test
Chiew Carol
 
An Introduction To Testing In AngularJS Applications
Rohan Chandane
 
What the HTML? - The Holy Grail
James Ford
 
JavaScript TDD with Jasmine and Karma
Christopher Bartling
 
AngularJS Unit Testing w/Karma and Jasmine
foxp2code
 
Angular Unit Test
Michael Haberman
 
Angular testing
Raissa Ferreira
 
AngularJS Development Services
Kretoss Technology
 
Testing Angular apps_ A complete guide for developers.pdf
Peerbits
 
Angularjs - Unit testing introduction
Nir Kaufman
 
Front end unit testing using jasmine
Gil Fink
 
Ad

More from Kourosh Sajjadi (8)

PPTX
Malware Classification Using Deep Learning
Kourosh Sajjadi
 
PDF
Parallel Generalized Hough Transform Using MPI and GCP - Report
Kourosh Sajjadi
 
PPTX
Parallel Generalized Hough Transform Using MPI and GCP - Presentation
Kourosh Sajjadi
 
PDF
DNS Cache Poisoning
Kourosh Sajjadi
 
PDF
Digital Content Retrieval Final Report
Kourosh Sajjadi
 
PDF
Fake News and Their Detection
Kourosh Sajjadi
 
PDF
Design and Implementation in Software Engineering
Kourosh Sajjadi
 
PDF
Scrum
Kourosh Sajjadi
 
Malware Classification Using Deep Learning
Kourosh Sajjadi
 
Parallel Generalized Hough Transform Using MPI and GCP - Report
Kourosh Sajjadi
 
Parallel Generalized Hough Transform Using MPI and GCP - Presentation
Kourosh Sajjadi
 
DNS Cache Poisoning
Kourosh Sajjadi
 
Digital Content Retrieval Final Report
Kourosh Sajjadi
 
Fake News and Their Detection
Kourosh Sajjadi
 
Design and Implementation in Software Engineering
Kourosh Sajjadi
 
Ad

Recently uploaded (20)

PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Tally software_Introduction_Presentation
AditiBansal54083
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 

Angular Testing

  • 1. ngular Testing Islamic Azad University, Najafabad Branch Faculty of Computer Engineering SeyedKourosh Sajjadi October, 2020 Jasmine + ARMA
  • 2. 24.10.20 Your name here (insert->page number) 2 Contents ● 1. Introduction ● 2. Theoretical section – 2.1 Karma – 2.2 Jasmine ● 2.2.a Test suites ● 2.2.b Test cases ● 2.2.c Expectations ● 2.2.c Matchers ● 2.2.d Spies ● 4. Practice ● 5. Suggested reading ● 6. References
  • 3. 24.10.20 Your name here (insert->page number) 3 Introduction Why Test ? ● As features and codebases grow, manual QA becomes more expensive, time consuming, and error prone. ● We test our code is to verify that it behaves as we expect it to. ● Tests are the best way to prevent software defects. ● As a result of this process you'll find you have better feature documentation for yourself.
  • 4. 24.10.20 Your name here (insert->page number) 4 Karma What is Karma ? ● Karma is a direct product of the AngularJS team. ● Karma is the default test runner for applications created with the Angular CLI. ● Karma provides you options to replace Jasmine with other testing frameworks such as Mocha and Qunit. ● your typical interaction with Karma will be to run ng test.
  • 5. 24.10.20 Your name here (insert->page number) 5 Jasmine What is Jasmine ? ● Jasmine is a behavior-driven development framework for testing JavaScript code that plays very well with Karma. ● Similar to Karma, it’s also the recommended testing framework as it’s setup for you with the Angular CLI.
  • 6. 24.10.20 Your name here (insert->page number) 6 Test Suites Suite ● Begins with Jasmine function describe. – Takes two parameters: ● string – a name or title for what is being tested ● function – block of code that implements the suit
  • 7. 24.10.20 Your name here (insert->page number) 7 Test Cases Spec ● Begins with Jasmine function it. – Takes two parameters: ● string – title of the spec ● function – the spec, or the test case
  • 8. 24.10.20 Your name here (insert->page number) 8 Expectations Expectations ● Buit with function expect. – Takes the actual value. ● Is chained with a matcher function. – Takes the expected value. Eg. expect(actualValue).toEqual(expectedValue);
  • 9. 24.10.20 Your name here (insert->page number) 9 Matchers Matchers ● Implements a boolean comparison between the actual value and the expected value. ● Resposible for reporting Jasmine if expectation is true or false. Eg. excpect(a).not.toBe(null);
  • 10. 24.10.20 Your name here (insert->page number) 10 Practice
  • 11. 24.10.20 Your name here (insert->page number) 11 Suggested Reading ● BDD: https://blog.testlodge.com/what-is-bdd/ ● Angular Testing: https://angular.io/guide/testing#setup ● Jasmine: https://jasmine.github.io/
  • 12. 24.10.20 Your name here (insert->page number) 12 References ● https://www.slideshare.net/rai200890/angular-testing-45106036 ?qid=bbd9f6c9-aaa5-4bfb-a5df-c27968c30bc2&v=&b=&from_s earch=1 ● https://www.digitalocean.com/community/tutorials/testing-angula r-with-jasmine-and-karma-part-1 ● https://www.positronx.io/angular-unit-testing-application-with-jas mine-karma/ ● https://jasmine.github.io/tutorials/your_first_suite