Alok Guha Unit Testing Framework for JavaScript.

Slides:



Advertisements
Similar presentations
JavaScript I. JavaScript is an object oriented programming language used to add interactivity to web pages. Different from Java, even though bears some.
Advertisements

Molecular Biomedical Informatics Web Programming 1.
Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
If R = {(x,y)| y = 3x + 2}, then R -1 = (1) x = 3y + 2 (2) y = (x – 2)/3 (3) {(x,y)| y = 3x + 2} (4) {(x,y)| y = (x – 2)/3} (5) {(x,y)| y – 2 = 3x} (6)
SPLINT STATIC CHECKING TOOL Sripriya Subramanian 10/29/2002.
1/20 Generalized Symbolic Execution for Model Checking and Testing Charngki PSWLAB Generalized Symbolic Execution for Model Checking and Testing.
Coding Standard: General Rules 1.Always be consistent with existing code. 2.Adopt naming conventions consistent with selected framework. 3.Use the same.
Behavior-Driven Development
Automated Testing but like For PowerShell Rob Reynolds.
The unknown spice girl. Aka NineCollective Jasmine Testing.
CS102 Data Types in Java CS 102 Java’s Central Casting.
* Who Am I? * State of the Room? * Ways to test Javascript? * Different Testing Environments? * Overview of Testing Tools * Using Testing in your Workflow.
Living Requirements using Behavior Driven Development
QA Automation Solution. Solution Architecture Test Management tool CI Tool Automation framework Testing Project BDD Tool Text of test to Testing Project.
Mock Objects. What are Mock Objects  Any dummy object that stands in for a real object that is not available, or is difficult to use in a test case 
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
4.1 JavaScript Introduction
Zero to Testing in JavaScript Basics of testing in JS.
JavaScript JavaScript is a scripting language that is most commonly used to add client- side programming to a web page. Some of the things it is used for.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
Writing various AJAX forms in Drupal 7 1. Overview of Form API 2. Ctools 2.1 Ctools features 3. Ajax 3.1 Ajax Forms in Drupal 4. Putting it all together.
JavaScript Lecture 6 Rachel A Ober
1 JavaScript. 2 What’s wrong with JavaScript? A very powerful language, yet –Often hated –Browser inconsistencies –Misunderstood –Developers find it painful.
CISC474 - JavaScript 03/02/2011. Some Background… Great JavaScript Guides: –
© 2014, Glarimy. All rights reserved. G l a r i m y.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
Algorithms and Algorithm Analysis The “fun” stuff.
E FFECTIVE C# 50 Specific Ways to Improve Your C# Second Edition Bill Wagner محمد حسین سلطانی.
VDM++ Tutorial Model Quality. Overview Introduction Assessing internal consistency Assessing external consistency.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
Post-Module JavaScript BTM 395: Internet Programming.
CIS 270—Application Development II Chapter 8—Classes and Objects: A Deeper Look.
HOW AND WHY TO LOVE CUCUMBER By Dana Scheider. Is This Your Programming Experience?
Unit Testing in JavaScript with Mocha, Chai and Karma SoftUni Team Technical Trainers Software University
JavaScript Overview Developer Essentials How to Code Language Constructs The DOM concept- API, (use W3C model) Objects –properties Methods Events Applications;
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
“The world’s most misunderstood language has become the world’s most popular programming language” Akshay Arora
JavaScript Dynamic Active Web Pages Client Side Scripting.
Scripting Languages ● Perl, Python, Unix Shell, VB, JavaScript, etc. ● Glue Languages. ● Typeless. ● Interchangeable Code and Data. ● Interpreted vs. Compiled.
Java Script. introduction Today’s web sites need to go much beyond HTML. browsing through a web site, to actually interact with the web site. The web.
Debugging and Printing George Mason University. Today’s topics Review of Chapter 3: Printing and Debugging Go over examples and questions debugging in.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
Announcements Assignment 2 Out Today Quiz today - so I need to shut up at 4:25 1.
Introduction to JavaScript academy.zariba.com 1. Lecture Content 1.What is JavaScript? 2.JavaScript Pros and Cons 3.The weird JavaScript stuff 4.Including.
Powerpoint Templates Page 1 Powerpoint Templates Unit Testing Ari Seppi
UNIT TESTING IN ANGULARJS Dhananjay
PHPUnit vs PHPSpec © Rudolf Horváth
Accessibility into Automation
Techniques and Practices for Testing Angular
Test Automation CS 4501 / 6501 Software Testing
Scope, Objects, Strings, Numbers
Clone Refactoring with Lambda Expressions
Javascript Conditionals.
React Revived Web Driver IO for Testers
JavaScript an introduction.
CIS16 Application Development – Programming with Visual Basic
Lightning Component Testing with Jasmine Jasmine is a behaviour-driven development framework - that is used for the purpose of testing Javascript code.
Arrays and Collections
CS5220 Advanced Topics in Web Programming JavaScript Basics
Web Design and Development
Matcher functions boolean find() Attempts to find the next subsequence of the input sequence that matches the pattern. boolean lookingAt() Attempts to.
Versatile workflow management Tool
Open Source Tool Based Automation solution with Continuous Integration and end to end BDD Implementation Arun Krishnan - Automation Manager Maria Afzal-
Announcements Quiz 5 HW6 due October 23
JavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications
Reasoning with Types.
Presentation transcript:

Alok Guha Unit Testing Framework for JavaScript

Why Unit Testing ? Instant satisfaction Code Against Your API While or Before it is Built Leads to a Better Design Understand How Your Code Works Confidence in Your Code

Why UTs are more important with JavaScript Because its weak-typed language Works on client side. Faster to test Unit Tests than to browse actual application.

Jasmine A BDD framework for JavaScript testing a behavior-driven development framework for testing JavaScript code. does not depend on any other JavaScript frameworks does not require DOM. Can be integrated with any CI tool.

Suits & Spects

Expectations & Matchers To express what you expect about behavior of your code. Matcher implements a Boolean comparison between the actual value and the expected value

Frequently Used Matchers The 'toBe' matcher compares with === The 'toEqual' matcher The 'toMatch' matcher is for regular expressions The 'toBeDefined' matcher compares against `undefined` The `toBeUndefined` matcher compares against `undefined` The 'toBeNull' matcher compares against null The 'toBeTruthy' matcher is for boolean casting testing The 'toBeFalsy' matcher is for boolean casting testing The 'toContain' matcher is for finding an item in an Array Every matcher’s criteria can be inverted by prepending.not

beforeEach & afterEach Both takes a function which executes before and after execution of each spec.

Spy These are mock or fake calls to method. Spies should be created before expectations. Spies can be checked if they were called or not, and what was calling arguments.

Think Tests ?

Possible Test cases a & b should be defined always. If a & b defined it should return sum of them. if a or b is not defined, result should be undefined. Result should be in same cast as input provided.

Lets welcome Jasmine Live examples

references My own experiences.