var p1Message SUCCESS var p2Message SUCCESS var p3Message SUCCESS var

Var p1message success var p2message success var

This preview shows page 17 - 26 out of 26 pages.

var p1Message = 'SUCCESS'; var p2Message = 'SUCCESS'; var p3Message = 'SUCCESS'; var varDeclared = ['varDeclared', 'p1Message', 'p2Message', 'p3Message'];
Image of page 17
Debug
Image of page 18
Ways to debug Ƭ Insert console.log() statements to test expected values Ƭ Using Chrome Javascript Console Ƭ Open javascript console Ƭ Put break points Ƭ Run the code line by line Ƭ Print variables Ƭ Run function
Image of page 19
Test Code - Example Walkthrough
Image of page 20
cs142-test-project2.js var cs142MakeMultiFilter; var Cs142TemplateProcessor; Ƭ global scope Ƭ undefined if they are not defined anywhere Ƭ if they are defined in the global scope by some other script, they will have those values. Ƭ be careful of case when declaring your functions
Image of page 21
cs142-test-project2.js- Testing p1 typeof cs142MakeMultiFilter!== 'function' Ƭ typeof to see what cs142MakeMultiFilter is Ƭ !== versus != Ɣ !== without type conversion
Image of page 22
cs142-test-project2.js- Testing p1 console.error('cs142MakeMultiFilter does not return a function', filterFunc); Ƭ Log an error message
Image of page 23
Cs142-test-project2.js- Testing p1 Ƭ Check 1: Make sure cs142MakeFilterFunction returns a function when given the correct parameters
Image of page 24
Cs142-test-project2.js- Testing p1 Ƭ Check 2: If there is no filter function passed in, return the original array
Image of page 25
End
Image of page 26

You've reached the end of your free preview.

Want to read all 26 pages?

  • Fall '09
  • 142-test-project, Project2 Code

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture