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   ...
“    Javascript Testing Framework using Rhino.     This works similarly to other nUnit testing     frameworks, though some...
“    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 bro...
“   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.sourceforg...
$ jspec init helloworldTemplate initialized at `helloworld$ lshelloworld$ cd helloworld/helloworld $helloworld $ lsHistory...
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.helloworl...
EXAMPLES:  # Run once in default browser  jspec run  # Run once in Safari and Firefox  jspec run --browsers Safari,Firefox...
Matchers•   be                  •   be_true•   eql                 •   be_false•   equal               •   be_type•   be_a...
P&R
Javascript orientado a testes
Javascript orientado a testes
Javascript orientado a testes
Upcoming SlideShare
Loading in...5
×

Javascript orientado a testes

1,064

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,064
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \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
  • Transcript of "Javascript orientado a testes"

    1. 1. Javascript orientado a testes Alexandre Gomes
    2. 2. TDDTDDTDDTDDTDDTDD
    3. 3. “ 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/
    4. 4. “ 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/
    5. 5. “ JSSpec is a Javascript BDD (Behavior Driven Development) framework.http://code.google.com/p/jsspec/
    6. 6. “ A Javascript BDD Framework with nested describes, a convenient assertion syntax, and an intuitive test browser.https://github.com/nkallen/screw-unit
    7. 7. “ JSpec is a extremely small, yet very powerful testing framework.http://visionmedia.github.com/jspec/
    8. 8. http://pivotal.github.com/jasmine/ http://jsunity.com/https://github.com/drnic/jsunittest http://j3unit.sourceforge.net/
    9. 9. $ jspec init helloworldTemplate initialized at `helloworld$ lshelloworld$ cd helloworld/helloworld $helloworld $ lsHistory.md Readme.md lib spechelloworld $ jspec run
    10. 10. seu código javascript arquivos que executam o seu código javascript arquivos de teste
    11. 11. lib/yourlib.js
    12. 12. spec/unit/spec.js
    13. 13. helloworld $ jspec run
    14. 14. spec/unit/spec.js
    15. 15. helloworld $ jspec run
    16. 16. helloworld $ jspec run --browsers Firefox
    17. 17. helloworld $ jspec run --rhinoPasses: 1 Failures: 0 Duration: 37 msMatematicadeveria somar dois numeros inteiros.helloworld $
    18. 18. 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
    19. 19. 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
    20. 20. P&R

    ×