Software Testing
by Varun Vaddiparty
● User Interface Development
● Source Code
● Quality Assurance (software testing)
Need for software testing:
● Meets the requirements
● works as expected
● satisfies the need of customer
Different Methods...
Unit Testing
● Verify the functionality of specific section of
the code.
● Usually at the function level.
● To ensure that...
Qunit
● A Javascript unit testing framework.
● It can be used to test any generic Javascript
code.
● You can test your cod...
A minimal Qunit test setup.
The contents of test.js :
Result of the test:
Asserting Results
● Essential elements of any unit tests.
● You express the result expected and have the
testing framework...
ok()
● ok(truthy,[message])
● most basic assertion
● requires only one argument, in addition you
can send a string to show...
equal()
● equal(actual,expected,[message]);
● compares your expected value with the
actual value
examples:
equal(1,1,”1 eq...
deepEqual()
● deepEqual(actual,expected,[message]);
● can be used just like equal, is a better choice
● uses more accurate...
expect()
● used to check whether all the assertions have
been executed or not
asyncTest()
● used for asynchronous testing

Practical Example:
Thank You
Introduction to Unit Testing using QUnit
Introduction to Unit Testing using QUnit
Introduction to Unit Testing using QUnit
Introduction to Unit Testing using QUnit
Introduction to Unit Testing using QUnit
Upcoming SlideShare
Loading in …5
×

Introduction to Unit Testing using QUnit

385
-1

Published on

An Introduction to Unit testing, what it is, why is it needed and how it is done. Using QUnit.

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

  • Be the first to like this

No Downloads
Views
Total Views
385
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to Unit Testing using QUnit

  1. 1. Software Testing by Varun Vaddiparty
  2. 2. ● User Interface Development ● Source Code ● Quality Assurance (software testing)
  3. 3. Need for software testing: ● Meets the requirements ● works as expected ● satisfies the need of customer Different Methods: ● Static Testing ● Dynamic Testing
  4. 4. Unit Testing ● Verify the functionality of specific section of the code. ● Usually at the function level. ● To ensure that a specific function is working as expected.
  5. 5. Qunit ● A Javascript unit testing framework. ● It can be used to test any generic Javascript code. ● You can test your code in the browser itself.
  6. 6. A minimal Qunit test setup.
  7. 7. The contents of test.js :
  8. 8. Result of the test:
  9. 9. Asserting Results ● Essential elements of any unit tests. ● You express the result expected and have the testing framework compare them to the actual values that the functions output. Qunit provides three assertions: ● ok() ● equal() ● deepEqual()
  10. 10. ok() ● ok(truthy,[message]) ● most basic assertion ● requires only one argument, in addition you can send a string to show as a message examples: ok(true,”true succeeds”); ok(1==1,”test passed”);
  11. 11. equal() ● equal(actual,expected,[message]); ● compares your expected value with the actual value examples: equal(1,1,”1 equals 1, test passes”); equal(“”,0,”zero equals empty, test passes”);
  12. 12. deepEqual() ● deepEqual(actual,expected,[message]); ● can be used just like equal, is a better choice ● uses more accurate comparison operator (===) instead of simple (==) examples: deepEqual(0,””,”test fails, zero not equal to empty”);
  13. 13. expect() ● used to check whether all the assertions have been executed or not
  14. 14. asyncTest() ● used for asynchronous testing Practical Example:
  15. 15. Thank You
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×