• Save
Javascript orientado a testes
Upcoming SlideShare
Loading in...5
×
 

Javascript orientado a testes

on

  • 1,244 views

 

Statistics

Views

Total Views
1,244
Slideshare-icon Views on SlideShare
1,243
Embed Views
1

Actions

Likes
2
Downloads
0
Comments
0

1 Embed 1

http://paper.li 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike LicenseCC Attribution-NonCommercial-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • TODO\n- Subclasse com chamada a A.call(this) no construtor\n\nRequisitos:\n- Ruby\n- RubyGems (ruby setup.rb)\n- JSpec (gem install jspec)\n

Javascript orientado a testes Javascript orientado a testes Presentation Transcript

  • Javascript orientado a testes Alexandre Gomes
  • TDDTDDTDDTDDTDDTDD
  • “ JsUnit is a Unit Testing framework for client-side (in-browser) JavaScript. It is essentially a port of JUnit to JavaScript http://www.jsunit.net/
  • “ Javascript Testing Framework using Rhino. This works similarly to other nUnit testing frameworks, though somewhat customized for javascript. It is exceedingly small, but also surprisingly powerful.http://code.google.com/p/rhinounit/
  • “ JSSpec is a Javascript BDD (Behavior Driven Development) framework.http://code.google.com/p/jsspec/
  • “ A Javascript BDD Framework with nested describes, a convenient assertion syntax, and an intuitive test browser.https://github.com/nkallen/screw-unit
  • “ JSpec is a extremely small, yet very powerful testing framework.http://visionmedia.github.com/jspec/
  • http://pivotal.github.com/jasmine/ http://jsunity.com/https://github.com/drnic/jsunittest http://j3unit.sourceforge.net/
  • $ jspec init helloworldTemplate initialized at `helloworld$ lshelloworld$ cd helloworld/helloworld $helloworld $ lsHistory.md Readme.md lib spechelloworld $ jspec run
  • seu código javascript arquivos que executam o seu código javascript arquivos de teste
  • lib/yourlib.js
  • spec/unit/spec.js
  • helloworld $ jspec run
  • spec/unit/spec.js
  • helloworld $ jspec run
  • helloworld $ jspec run --browsers Firefox
  • helloworld $ jspec run --rhinoPasses: 1 Failures: 0 Duration: 37 msMatematicadeveria somar dois numeros inteiros.helloworld $
  • EXAMPLES: # Run once in default browser jspec run # Run once in Safari and Firefox jspec run --browsers Safari,Firefox # Run once in Opera, Firefox, Chrome, and WebKit jspec run --browsers opera,ff,chrome,webkit # Run custom spec file jspec run foo.html # Auto-run browsers when a file is altered jspec run --bind --browsers Safari,Firefox # Shortcut for the previous example jspec --browsers Safari,Firefox # Run Rhino specs jspec run --rhino # Auto-run rhino when a file is altered jspec --rhino
  • Matchers• be • be_true• eql • be_false• equal • be_type• be_a • be_greater_than• be_an • be_less_than• be_an_instance_of • have• be_at_least • have_at_least• be_at_most • have_at_most• be_within • have_within• be_null • have_length• be_undefined • have_prop• be_empty • have_property
  • P&R