SlideShare a Scribd company logo
Unit testing with
   Your probably already doing it (debugging)
   Prevents regression/allows REFACTORING
   Fastest form of quality feedback
   Allows you to work on other peoples code
   Improves the design of your code
   Is a form of living documentation
   “The smallest testable part of an application”
     JavaScript public function === unit
   Utility Code
   Functional Code
Practical
   TDD – test driven development
     Write a test
     Run it (it’s red)
     Write some code
     Run it (it goes green)
     Repeat.
   Testing after the fact
     Boring
     Harder to write test code
     Tightly coupled test code
     Miss ‘conceptual’ errors
   Test during development
     New features ? Test driven development
     Bug fixes ? write tests for the unit
     Before refactor ? write tests before & modify
   Comprehensive suite of tests for your app
   Test lines ratio to code @3 : 1
   Run on every commit by CI
   ‘Stop the line’ when a test fails
   Behavior driven development (bdd)
     describe(”your module", function() {
             it(”should be unit tested", function()      {
                      expect(isUnitTested()).toBe(true);
             });
       });
Unit testing with Jasmine

More Related Content

PPTX
JavaScript Unit Testing
PPTX
Continuous Test Automation via CI (CodeMash 2012) - Automating the Agile way
PPTX
Testing JavaScript Applications
PPTX
Agile test practices
PPT
Code review
ODP
Beyond Unit Testing
PPTX
Unit tests benefits
PDF
Code Review Tool Evaluation
JavaScript Unit Testing
Continuous Test Automation via CI (CodeMash 2012) - Automating the Agile way
Testing JavaScript Applications
Agile test practices
Code review
Beyond Unit Testing
Unit tests benefits
Code Review Tool Evaluation

What's hot (20)

PPTX
Acceptance Test Driven Development and Robot Framework
PPTX
Unit Testing in Action - C#, NUnit, and Moq
PPTX
Testing the untestable
PDF
Behavior Driven Development with SpecFlow
PPT
TDD (Test Driven Design)
ODP
Documenting Code - Patterns and Anti-patterns - NLPW 2016
PPTX
Comparative Analysis Of GoLang Testing Frameworks
PPTX
Code review process with JetBrains UpSource
PPT
Unit testing
PPT
Test Driven Development
PPTX
Git branching policy and review comment's prefix
PDF
Win at life with unit testing
PPTX
Functional & Performance Test Automation with CI
PPT
Test Driven Development
PPTX
Behaviour Driven Development with SpecFlow
KEY
Client Side Unit Testing
PPTX
Software Quality via Unit Testing
PPTX
Unit Tests And Automated Testing
PDF
Test Driven Development (TDD)
PPTX
TDD - Agile
Acceptance Test Driven Development and Robot Framework
Unit Testing in Action - C#, NUnit, and Moq
Testing the untestable
Behavior Driven Development with SpecFlow
TDD (Test Driven Design)
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Comparative Analysis Of GoLang Testing Frameworks
Code review process with JetBrains UpSource
Unit testing
Test Driven Development
Git branching policy and review comment's prefix
Win at life with unit testing
Functional & Performance Test Automation with CI
Test Driven Development
Behaviour Driven Development with SpecFlow
Client Side Unit Testing
Software Quality via Unit Testing
Unit Tests And Automated Testing
Test Driven Development (TDD)
TDD - Agile
Ad

Viewers also liked (6)

PDF
React.js: The hottest JS lib for building UIs
PPTX
React + Redux + TypeScript === ♥
PDF
Robust web apps with React.js
PDF
Unit testing with mocha
PPTX
Reactjs
PPTX
React and Flux life cycle with JSX, React Router and Jest Unit Testing
React.js: The hottest JS lib for building UIs
React + Redux + TypeScript === ♥
Robust web apps with React.js
Unit testing with mocha
Reactjs
React and Flux life cycle with JSX, React Router and Jest Unit Testing
Ad

Similar to Unit testing with Jasmine (20)

PPT
Behavior Driven Development by Example
PDF
Test Driven iOS Development (TDD)
PPTX
Test driven development in .Net - 2010 + Eclipse
PDF
Test Driven Development
PDF
TDD Workshop UTN 2012
ODP
xUnit and TDD: Why and How in Enterprise Software, August 2012
PPT
Software Design for Testability
PPTX
Coding Naked
PPT
Nguyenvandungb seminar
DOCX
expBSIT (1) (1)
PPTX
Test-Driven Development In Action
PPT
Introduction to test programming
PDF
Test driven development
PPTX
Test-driven development & Behavior-driven development basics
PDF
Agile Software Development in Practice - A Developer Perspective
PPTX
Cleaner Code Through Test-Driven Development
PPT
Unit testing
PPTX
BDD presentation
PPTX
Understanding Unit Testing
PPT
Stopping the Rot - Putting Legacy C++ Under Test
Behavior Driven Development by Example
Test Driven iOS Development (TDD)
Test driven development in .Net - 2010 + Eclipse
Test Driven Development
TDD Workshop UTN 2012
xUnit and TDD: Why and How in Enterprise Software, August 2012
Software Design for Testability
Coding Naked
Nguyenvandungb seminar
expBSIT (1) (1)
Test-Driven Development In Action
Introduction to test programming
Test driven development
Test-driven development & Behavior-driven development basics
Agile Software Development in Practice - A Developer Perspective
Cleaner Code Through Test-Driven Development
Unit testing
BDD presentation
Understanding Unit Testing
Stopping the Rot - Putting Legacy C++ Under Test

Unit testing with Jasmine

  • 2. Your probably already doing it (debugging)  Prevents regression/allows REFACTORING  Fastest form of quality feedback  Allows you to work on other peoples code  Improves the design of your code  Is a form of living documentation
  • 3. “The smallest testable part of an application”  JavaScript public function === unit  Utility Code  Functional Code
  • 5. TDD – test driven development  Write a test  Run it (it’s red)  Write some code  Run it (it goes green)  Repeat.
  • 6. Testing after the fact  Boring  Harder to write test code  Tightly coupled test code  Miss ‘conceptual’ errors
  • 7. Test during development  New features ? Test driven development  Bug fixes ? write tests for the unit  Before refactor ? write tests before & modify
  • 8. Comprehensive suite of tests for your app  Test lines ratio to code @3 : 1  Run on every commit by CI  ‘Stop the line’ when a test fails
  • 9. Behavior driven development (bdd)  describe(”your module", function() { it(”should be unit tested", function() { expect(isUnitTested()).toBe(true); }); });