Skip to content

Commit 3d4ab56

Browse files
committedJan 27, 2013
Adding initial changes for addyosmani#290
1 parent 41a86c6 commit 3d4ab56

5 files changed

+6
-15
lines changed
 

‎backbone-fundamentals.epub

316 Bytes
Binary file not shown.

‎backbone-fundamentals.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -8707,8 +8707,7 @@ The takeaway here is just to remember that if you're not (already) going through
87078707
87088708
# Unit Testing
87098709
8710-
8711-
## Unit Testing Backbone Applications With Jasmine
8710+
# Jasmine
87128711
87138712
## Introduction
87148713
@@ -8720,8 +8719,6 @@ As a basic example of unit testing is where a developer may wish to assert wheth
87208719
87218720
When building modern web-applications, it's typically considered best-practice to include automated unit testing as a part of your development process. Whilst we'll be focusing on Jasmine as a solution for this, there are a number of other alternatives worth considering, including QUnit.
87228721
8723-
## Jasmine
8724-
87258722
Jasmine describes itself as a behavior-driven development (BDD) framework for testing JavaScript code. Before we jump into how the framework works, it's useful to understand exactly what [BDD](http://en.wikipedia.org/wiki/Behavior_Driven_Development) is.
87268723
87278724
BDD is a second-generation testing approach first described by [Dan North](http://dannorth.net/introducing-bdd/) (the authority on BDD) which attempts to test the behavior of software. It's considered second-generation as it came out of merging ideas from Domain driven design (DDD) and lean software development, helping teams to deliver high quality software by answering many of the more confusing questions early on in the agile process. Such questions commonly include those concerning documentation and testing.

‎backbone-fundamentals.rtf

+1-2
Original file line numberDiff line numberDiff line change
@@ -6971,7 +6971,7 @@ Backbone fundamentals
69716971
{\pard \ql \f0 \sa180 \li0 \fi0 The benefit of this is that I don\u8217't need to go pulling in jQuery UI separately to be able to take advantage of these features. Thanks to the recent ThemeRoller my components can look pretty much exactly how I would like them to and users of the app can get a jQM UI for lower-resolutions and a jQM-ish UI for everything else.\par}
69726972
{\pard \ql \f0 \sa180 \li0 \fi0 The takeaway here is just to remember that if you\u8217're not (already) going through the hassle of conditional script/style loading based on screen-resolution (using matchMedia.js etc), there are simpler approaches that can be taken to cross-device component theming.\par}
69736973
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Unit Testing\par}
6974-
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Unit Testing Backbone Applications With Jasmine\par}
6974+
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 Jasmine\par}
69756975
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Introduction\par}
69766976
{\pard \ql \f0 \sa180 \li0 \fi0 One definition of unit testing is the process of taking the smallest piece of testable code in an application, isolating it from the remainder of your codebase and determining if it behaves exactly as expected. In this section, we\u8217'll be taking a look at how to unit test Backbone applications using a popular JavaScript testing framework called {\field{\*\fldinst{HYPERLINK "http://pivotal.github.com/jasmine/"}}{\fldrslt{\ul
69776977
Jasmine
@@ -6980,7 +6980,6 @@ Jasmine
69806980
{\pard \ql \f0 \sa180 \li0 \fi0 For an application to be considered \u8216'well\u8217'-tested, distinct functionality should ideally have its own separate unit tests where it\u8217's tested against the different conditions you expect it to work under. All tests must pass before functionality is considered \u8216'complete\u8217'. This allows developers to both modify a unit of code and its dependencies with a level of confidence about whether these changes have caused any breakage.\par}
69816981
{\pard \ql \f0 \sa180 \li0 \fi0 As a basic example of unit testing is where a developer may wish to assert whether passing specific values through to a sum function results in the correct output being returned. For an example more relevant to this book, we may wish to assert whether a user adding a new Todo item to a list correctly adds a Model of a specific type to a Todos Collection.\par}
69826982
{\pard \ql \f0 \sa180 \li0 \fi0 When building modern web-applications, it\u8217's typically considered best-practice to include automated unit testing as a part of your development process. Whilst we\u8217'll be focusing on Jasmine as a solution for this, there are a number of other alternatives worth considering, including QUnit.\par}
6983-
{\pard \ql \f0 \sa180 \li0 \fi0 \b \fs32 Jasmine\par}
69846983
{\pard \ql \f0 \sa180 \li0 \fi0 Jasmine describes itself as a behavior-driven development (BDD) framework for testing JavaScript code. Before we jump into how the framework works, it\u8217's useful to understand exactly what {\field{\*\fldinst{HYPERLINK "http://en.wikipedia.org/wiki/Behavior_Driven_Development"}}{\fldrslt{\ul
69856984
BDD
69866985
}}}

‎chapters/11-unit-testing.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Unit Testing
22

3-
4-
## Unit Testing Backbone Applications With Jasmine
3+
# Jasmine
54

65
## Introduction
76

@@ -13,8 +12,6 @@ As a basic example of unit testing is where a developer may wish to assert wheth
1312

1413
When building modern web-applications, it's typically considered best-practice to include automated unit testing as a part of your development process. Whilst we'll be focusing on Jasmine as a solution for this, there are a number of other alternatives worth considering, including QUnit.
1514

16-
## Jasmine
17-
1815
Jasmine describes itself as a behavior-driven development (BDD) framework for testing JavaScript code. Before we jump into how the framework works, it's useful to understand exactly what [BDD](http://en.wikipedia.org/wiki/Behavior_Driven_Development) is.
1916

2017
BDD is a second-generation testing approach first described by [Dan North](http://dannorth.net/introducing-bdd/) (the authority on BDD) which attempts to test the behavior of software. It's considered second-generation as it came out of merging ideas from Domain driven design (DDD) and lean software development, helping teams to deliver high quality software by answering many of the more confusing questions early on in the agile process. Such questions commonly include those concerning documentation and testing.

‎index.html

+3-5
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,9 @@ <h3>By Addy Osmani <a href="http://twitter.com/addyosmani">@addyosmani</a></h3>
287287
<li><a href="#jquery-mobile-going-beyond-mobile-application-development">jQuery Mobile: Going beyond mobile application development</a></li>
288288
</ul></li>
289289
</ul></li>
290-
<li><a href="#unit-testing">Unit Testing</a><ul>
291-
<li><a href="#unit-testing-backbone-applications-with-jasmine">Unit Testing Backbone Applications With Jasmine</a></li>
290+
<li><a href="#unit-testing">Unit Testing</a></li>
291+
<li><a href="#jasmine">Jasmine</a><ul>
292292
<li><a href="#introduction-2">Introduction</a></li>
293-
<li><a href="#jasmine">Jasmine</a></li>
294293
<li><a href="#suites-specs-spies">Suites, Specs &amp; Spies</a></li>
295294
<li><a href="#beforeeach-and-aftereach">beforeEach and afterEach()</a></li>
296295
<li><a href="#shared-scope">Shared scope</a></li>
@@ -7037,13 +7036,12 @@ <h3 id="jquery-mobile-going-beyond-mobile-application-development"><a href="#TOC
70377036
<p>The benefit of this is that I don’t need to go pulling in jQuery UI separately to be able to take advantage of these features. Thanks to the recent ThemeRoller my components can look pretty much exactly how I would like them to and users of the app can get a jQM UI for lower-resolutions and a jQM-ish UI for everything else.</p>
70387037
<p>The takeaway here is just to remember that if you’re not (already) going through the hassle of conditional script/style loading based on screen-resolution (using matchMedia.js etc), there are simpler approaches that can be taken to cross-device component theming.</p>
70397038
<h1 id="unit-testing"><a href="#TOC">Unit Testing</a></h1>
7040-
<h2 id="unit-testing-backbone-applications-with-jasmine"><a href="#TOC">Unit Testing Backbone Applications With Jasmine</a></h2>
7039+
<h1 id="jasmine"><a href="#TOC">Jasmine</a></h1>
70417040
<h2 id="introduction-2"><a href="#TOC">Introduction</a></h2>
70427041
<p>One definition of unit testing is the process of taking the smallest piece of testable code in an application, isolating it from the remainder of your codebase and determining if it behaves exactly as expected. In this section, we’ll be taking a look at how to unit test Backbone applications using a popular JavaScript testing framework called <a href="http://pivotal.github.com/jasmine/">Jasmine</a> from Pivotal Labs.</p>
70437042
<p>For an application to be considered <q>well</q>-tested, distinct functionality should ideally have its own separate unit tests where it’s tested against the different conditions you expect it to work under. All tests must pass before functionality is considered <q>complete</q>. This allows developers to both modify a unit of code and its dependencies with a level of confidence about whether these changes have caused any breakage.</p>
70447043
<p>As a basic example of unit testing is where a developer may wish to assert whether passing specific values through to a sum function results in the correct output being returned. For an example more relevant to this book, we may wish to assert whether a user adding a new Todo item to a list correctly adds a Model of a specific type to a Todos Collection.</p>
70457044
<p>When building modern web-applications, it’s typically considered best-practice to include automated unit testing as a part of your development process. Whilst we’ll be focusing on Jasmine as a solution for this, there are a number of other alternatives worth considering, including QUnit.</p>
7046-
<h2 id="jasmine"><a href="#TOC">Jasmine</a></h2>
70477045
<p>Jasmine describes itself as a behavior-driven development (BDD) framework for testing JavaScript code. Before we jump into how the framework works, it’s useful to understand exactly what <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">BDD</a> is.</p>
70487046
<p>BDD is a second-generation testing approach first described by <a href="http://dannorth.net/introducing-bdd/">Dan North</a> (the authority on BDD) which attempts to test the behavior of software. It’s considered second-generation as it came out of merging ideas from Domain driven design (DDD) and lean software development, helping teams to deliver high quality software by answering many of the more confusing questions early on in the agile process. Such questions commonly include those concerning documentation and testing.</p>
70497047
<p>If you were to read a book on BDD, it’s likely to also be described as being <q>outside-in and pull-based</q>. The reason for this is that it borrows the idea of pulling features from Lean manufacturing which effectively ensures that the right software solutions are being written by a) focusing on expected outputs of the system and b) ensuring these outputs are achieved.</p>

0 commit comments

Comments
 (0)
Please sign in to comment.