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
Ad

Recommended

Testing Angular
Testing Angular
Lilia Sfaxi
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 
Unit testing in JavaScript with Jasmine and Karma
Unit testing in JavaScript with Jasmine and Karma
Andrey Kolodnitsky
 
Functional Tests Automation with Robot Framework
Functional Tests Automation with Robot Framework
laurent bristiel
 
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
An Introduction to JUnit 5 and how to use it with Spring boot tests and Mockito
shaunthomas999
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Simplilearn
 
Unit Testing with Jest
Unit Testing with Jest
Maayan Glikser
 
Cypress Automation
Cypress Automation
Susantha Pathirana
 
Jmeter tool
Jmeter tool
Nhung Hồng Nguyễn
 
Component testing with cypress
Component testing with cypress
Walmyr Lima e Silva Filho
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
Edureka!
 
Git을 조금 더 알아보자!
Git을 조금 더 알아보자!
Young Kim
 
Selenium WebDriver
Selenium WebDriver
Rajathi-QA
 
Angular Unit Testing
Angular Unit Testing
Shailendra Chauhan
 
Unit Testing in Angular
Unit Testing in Angular
Knoldus Inc.
 
JMeter Intro
JMeter Intro
Sam Varadarajan
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Jemin Huh
 
Flutter and ML Kit For Firebase
Flutter and ML Kit For Firebase
Hamidou Bah
 
Rest api 테스트 수행가이드
Rest api 테스트 수행가이드
SangIn Choung
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
Peter Thomas
 
GitLab과 Kubernetes를 통한 CI/CD 구축
GitLab과 Kubernetes를 통한 CI/CD 구축
철구 김
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
Rudy De Busscher
 
No drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwright
Mastacheata1
 
Testing of React JS app
Testing of React JS app
Aleks Zinevych
 
Automated Test Framework with Cucumber
Automated Test Framework with Cucumber
Ramesh Krishnan Ganesan
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
dotCloud
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Samyak Bhalerao
 
Test strategy for web development
Test strategy for web development
alice yang
 

More Related Content

What's hot (20)

Jmeter tool
Jmeter tool
Nhung Hồng Nguyễn
 
Component testing with cypress
Component testing with cypress
Walmyr Lima e Silva Filho
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
Edureka!
 
Git을 조금 더 알아보자!
Git을 조금 더 알아보자!
Young Kim
 
Selenium WebDriver
Selenium WebDriver
Rajathi-QA
 
Angular Unit Testing
Angular Unit Testing
Shailendra Chauhan
 
Unit Testing in Angular
Unit Testing in Angular
Knoldus Inc.
 
JMeter Intro
JMeter Intro
Sam Varadarajan
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Jemin Huh
 
Flutter and ML Kit For Firebase
Flutter and ML Kit For Firebase
Hamidou Bah
 
Rest api 테스트 수행가이드
Rest api 테스트 수행가이드
SangIn Choung
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
Peter Thomas
 
GitLab과 Kubernetes를 통한 CI/CD 구축
GitLab과 Kubernetes를 통한 CI/CD 구축
철구 김
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
Rudy De Busscher
 
No drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwright
Mastacheata1
 
Testing of React JS app
Testing of React JS app
Aleks Zinevych
 
Automated Test Framework with Cucumber
Automated Test Framework with Cucumber
Ramesh Krishnan Ganesan
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
dotCloud
 
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
What is WebElement in Selenium | Web Elements & Element Locators | Edureka
Edureka!
 
Git을 조금 더 알아보자!
Git을 조금 더 알아보자!
Young Kim
 
Selenium WebDriver
Selenium WebDriver
Rajathi-QA
 
Unit Testing in Angular
Unit Testing in Angular
Knoldus Inc.
 
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Spring boot 를 적용한 전사모니터링 시스템 backend 개발 사례
Jemin Huh
 
Flutter and ML Kit For Firebase
Flutter and ML Kit For Firebase
Hamidou Bah
 
Rest api 테스트 수행가이드
Rest api 테스트 수행가이드
SangIn Choung
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 
Robot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs
 
API Test Automation Using Karate (Anil Kumar Moka)
API Test Automation Using Karate (Anil Kumar Moka)
Peter Thomas
 
GitLab과 Kubernetes를 통한 CI/CD 구축
GitLab과 Kubernetes를 통한 CI/CD 구축
철구 김
 
Finally, easy integration testing with Testcontainers
Finally, easy integration testing with Testcontainers
Rudy De Busscher
 
No drama here - E2E-testing django with playwright
No drama here - E2E-testing django with playwright
Mastacheata1
 
Testing of React JS app
Testing of React JS app
Aleks Zinevych
 
Installing and running Postfix within a docker container from the command line
Installing and running Postfix within a docker container from the command line
dotCloud
 

Similar to Angular Testing (20)

Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Samyak Bhalerao
 
Test strategy for web development
Test strategy for web development
alice yang
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011
David O'Dowd
 
Angular Unit testing.pptx
Angular Unit testing.pptx
RiyaBangera
 
Getting started with karate dsl
Getting started with karate dsl
Knoldus Inc.
 
Core Java Programming Language (JSE) : Chapter VIII - Exceptions and Assertions
Core Java Programming Language (JSE) : Chapter VIII - Exceptions and Assertions
WebStackAcademy
 
Software Testing Tecniques
Software Testing Tecniques
ersanbilik
 
Windmill Testing certification
Windmill Testing certification
Vskills
 
[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScript
Hazem Saleh
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
knowdiff
 
Testing Spark and Scala
Testing Spark and Scala
datamantra
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)
Jared Burrows
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016
Yves Hoppe
 
Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013
Hazem Saleh
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
Sigma Software
 
Testing the Untestable
Testing the Untestable
Mark Baker
 
Gatling Performance Workshop
Gatling Performance Workshop
Sai Krishna
 
Automock: Interaction-Based Mock Code Generation
Automock: Interaction-Based Mock Code Generation
Sabrina Souto
 
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Unit testing of java script and angularjs application using Karma Jasmine Fra...
Samyak Bhalerao
 
Test strategy for web development
Test strategy for web development
alice yang
 
SoftTest Ireland: Model Based Testing - January 27th 2011
SoftTest Ireland: Model Based Testing - January 27th 2011
David O'Dowd
 
Angular Unit testing.pptx
Angular Unit testing.pptx
RiyaBangera
 
Getting started with karate dsl
Getting started with karate dsl
Knoldus Inc.
 
Core Java Programming Language (JSE) : Chapter VIII - Exceptions and Assertions
Core Java Programming Language (JSE) : Chapter VIII - Exceptions and Assertions
WebStackAcademy
 
Software Testing Tecniques
Software Testing Tecniques
ersanbilik
 
Windmill Testing certification
Windmill Testing certification
Vskills
 
[FullStack NYC 2019] Effective Unit Tests for JavaScript
[FullStack NYC 2019] Effective Unit Tests for JavaScript
Hazem Saleh
 
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
knowdiff
 
Testing Spark and Scala
Testing Spark and Scala
datamantra
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Ortus Solutions, Corp
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Make Your Build Great Again (DroidConSF 2017)
Make Your Build Great Again (DroidConSF 2017)
Jared Burrows
 
Joomla! Testing - J!DD Germany 2016
Joomla! Testing - J!DD Germany 2016
Yves Hoppe
 
Efficient JavaScript Unit Testing, March 2013
Efficient JavaScript Unit Testing, March 2013
Hazem Saleh
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
Sigma Software
 
Testing the Untestable
Testing the Untestable
Mark Baker
 
Gatling Performance Workshop
Gatling Performance Workshop
Sai Krishna
 
Automock: Interaction-Based Mock Code Generation
Automock: Interaction-Based Mock Code Generation
Sabrina Souto
 
Ad

More from Kourosh Sajjadi (8)

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

Recently uploaded (20)

Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
 
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
Enable Your Cloud Journey With Microsoft Trusted Partner | IFI Tech
IFI Techsolutions
 
Key Challenges in Troubleshooting Customer On-Premise Applications
Key Challenges in Troubleshooting Customer On-Premise Applications
Tier1 app
 
Streamlining CI/CD with FME Flow: A Practical Guide
Streamlining CI/CD with FME Flow: A Practical Guide
Safe Software
 
Sysinfo OST to PST Converter Infographic
Sysinfo OST to PST Converter Infographic
SysInfo Tools
 
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Test Case Design Techniques – Practical Examples & Best Practices in Software...
Muhammad Fahad Bashir
 
ElectraSuite_Prsentation(online voting system).pptx
ElectraSuite_Prsentation(online voting system).pptx
mrsinankhan01
 
Complete WordPress Programming Guidance Book
Complete WordPress Programming Guidance Book
Shabista Imam
 
Reimagining Software Development and DevOps with Agentic AI
Reimagining Software Development and DevOps with Agentic AI
Maxim Salnikov
 
A Guide to Telemedicine Software Development.pdf
A Guide to Telemedicine Software Development.pdf
Olivero Bozzelli
 
Digital Transformation: Automating the Placement of Medical Interns
Digital Transformation: Automating the Placement of Medical Interns
Safe Software
 
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Automated Migration of ESRI Geodatabases Using XML Control Files and FME
Safe Software
 
Zoho Creator Solution for EI by Elsner Technologies.docx
Zoho Creator Solution for EI by Elsner Technologies.docx
Elsner Technologies Pvt. Ltd.
 
Download Adobe Illustrator Crack free for Windows 2025?
Download Adobe Illustrator Crack free for Windows 2025?
grete1122g
 
arctitecture application system design os dsa
arctitecture application system design os dsa
za241967
 
How Automation in Claims Handling Streamlined Operations
How Automation in Claims Handling Streamlined Operations
Insurance Tech Services
 
Y - Recursion The Hard Way GopherCon EU 2025
Y - Recursion The Hard Way GopherCon EU 2025
Eleanor McHugh
 
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
 
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
Milwaukee Marketo User Group June 2025 - Optimize and Enhance Efficiency - Sm...
BradBedford3
 
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
Why Every Growing Business Needs a Staff Augmentation Company IN USA.pdf
mary rojas
 
Advance Doctor Appointment Booking App With Online Payment
Advance Doctor Appointment Booking App With Online Payment
AxisTechnolabs
 

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