HTML and CSS Reference
In-Depth Information
"test format specifier %m": function () {
assert("%m should return month",
Date.formats.m(this.date) === "10");
},
"test format specifier %d": function () {
assert("%d should return date",
Date.formats.d(this.date) === "02");
},
"test format specifier %y": function () {
assert("%y should return year as two digits",
Date.formats.y(this.date) === "09");
},
"test format shorthand %F": function () {
assert("%F should be shortcut for %Y-%m-%d",
Date.formats.F === "%Y-%m-%d");
}
});
1.5 Benefits of Unit Tests
Writing tests is an investment. The most common objection to unit testing is that
it takes too much time. Of course testing your application takes time. But the
alternative to automated testing is usually not to avoid testing your application
completely. In the absence of tests, developers are left with a manual testing process,
which is highly inefficient: we write the same throwaway tests over and over again,
and we rarely rigorously test our code unless it's shown to not work, or we otherwise
expect it to have defects. Automated testing allows us to write a test once and run
it as many times as we wish.
1.5.1 Regression Testing
Sometimes we make mistakes in our code. Those mistakes might lead to bugs that
sometimes find their way into production. Even worse, sometimes we fix a bug but
later have that same bug creep back out in production. Regression testing helps us
avoid this. By “trapping” a bug in a test, our test suite will notify us if the bug ever
makes a reappearance. Because automated tests are automated and reproducible,
we can run all our tests prior to pushing code into production to make sure that
past mistakes stay in the past. As a system grows in size and complexity, manual
regression testing quickly turns into an impossible feat.
 
 
Search WWH ::




Custom Search