<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Unit_Testing_with_Javascript</id>
	<title>Unit Testing with Javascript - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://training-course-material.com/index.php?action=history&amp;feed=atom&amp;title=Unit_Testing_with_Javascript"/>
	<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Unit_Testing_with_Javascript&amp;action=history"/>
	<updated>2026-04-21T08:48:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://training-course-material.com/index.php?title=Unit_Testing_with_Javascript&amp;diff=89043&amp;oldid=prev</id>
		<title>Lsokolowski1 at 09:27, 28 August 2025</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Unit_Testing_with_Javascript&amp;diff=89043&amp;oldid=prev"/>
		<updated>2025-08-28T09:27:31Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 09:27, 28 August 2025&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l2&quot;&gt;Line 2:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 2:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;slideshow style=&quot;nobleprog&quot; headingmark=&quot;⌘&quot; incmark=&quot;…&quot; scaled=&quot;true&quot; font=&quot;Trebuchet MS&quot; &amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;title: Unit Testing with Javascript Training Course&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;title: Unit Testing with Javascript Training Course&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;author: Lukasz Sokolowski&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;;author: Lukasz Sokolowski&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;/slideshow&amp;gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lsokolowski1</name></author>
	</entry>
	<entry>
		<id>https://training-course-material.com/index.php?title=Unit_Testing_with_Javascript&amp;diff=85532&amp;oldid=prev</id>
		<title>Lsokolowski: /* Writing More Tests ⌘ */</title>
		<link rel="alternate" type="text/html" href="https://training-course-material.com/index.php?title=Unit_Testing_with_Javascript&amp;diff=85532&amp;oldid=prev"/>
		<updated>2022-04-08T21:06:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Writing More Tests ⌘&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:private]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;slideshow style=&amp;quot;nobleprog&amp;quot; headingmark=&amp;quot;⌘&amp;quot; incmark=&amp;quot;…&amp;quot; scaled=&amp;quot;true&amp;quot; font=&amp;quot;Trebuchet MS&amp;quot; &amp;gt;&lt;br /&gt;
;title: Unit Testing with Javascript Training Course&lt;br /&gt;
;author: Lukasz Sokolowski&lt;br /&gt;
&amp;lt;/slideshow&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Unit Testing with Javascript ==&lt;br /&gt;
Unit Testing with Javascript Training Materials&lt;br /&gt;
&lt;br /&gt;
{{Can I use your material}}&lt;br /&gt;
&lt;br /&gt;
== Introduction ⌘==&lt;br /&gt;
* How Unit Testing Works&lt;br /&gt;
&lt;br /&gt;
=== Unit test ⌘===&lt;br /&gt;
* A function or method, which &amp;#039;&amp;#039;&amp;#039;invokes a unit of module&amp;#039;&amp;#039;&amp;#039; in software &lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Checks assumptions&amp;#039;&amp;#039;&amp;#039; about the system that the developer has in mind&lt;br /&gt;
* Helps the developer &amp;#039;&amp;#039;&amp;#039;test the logical functionality&amp;#039;&amp;#039;&amp;#039; of any module&lt;br /&gt;
* A &amp;#039;&amp;#039;&amp;#039;unit&amp;#039;&amp;#039;&amp;#039; is the &amp;#039;&amp;#039;testable piece of software&amp;#039;&amp;#039;&lt;br /&gt;
** It can have &amp;#039;&amp;#039;&amp;#039;more than one&amp;#039;&amp;#039;&amp;#039; input and normally a &amp;#039;&amp;#039;&amp;#039;single output&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** Sometimes, we treat &amp;#039;&amp;#039;&amp;#039;a module of a system&amp;#039;&amp;#039;&amp;#039; as a unit&lt;br /&gt;
&lt;br /&gt;
=== Unit test con&amp;#039;t ⌘===&lt;br /&gt;
* Is only relevant to developers who are &amp;#039;&amp;#039;&amp;#039;closely working with the code&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Is only applicable to test a &amp;#039;&amp;#039;&amp;#039;logical piece of a code&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Illogical code&amp;#039;&amp;#039;&amp;#039; would not be tested with the use of it&lt;br /&gt;
** Example: &amp;#039;&amp;#039;getting and setting values in text field&amp;#039;&amp;#039;&lt;br /&gt;
* Usually, the first unit test is &amp;#039;&amp;#039;&amp;#039;hard to write&amp;#039;&amp;#039;&amp;#039; &lt;br /&gt;
** Requires more &amp;#039;&amp;#039;&amp;#039;time&amp;#039;&amp;#039;&amp;#039;, makes the process more &amp;#039;&amp;#039;&amp;#039;painful&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** We should follow a practice of &amp;#039;&amp;#039;&amp;#039;asking questions before writing&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*** &amp;#039;&amp;#039;Should I use an already available unit test framework or write my own custom code?&amp;#039;&amp;#039;&lt;br /&gt;
*** &amp;#039;&amp;#039;What about an automated build process?&amp;#039;&amp;#039;&lt;br /&gt;
*** &amp;#039;&amp;#039;How about collecting, displaying, and tracking unit test code coverage?&amp;#039;&amp;#039;&lt;br /&gt;
* However, it makes life so much &amp;#039;&amp;#039;&amp;#039;easier&amp;#039;&amp;#039;&amp;#039; than before&lt;br /&gt;
&lt;br /&gt;
== Overview of Javascript Unit Test Frameworks ⌘==&lt;br /&gt;
* Jasmine, Mocha, Jest, Chai, QUnit&lt;br /&gt;
* Unit test uses cases&lt;br /&gt;
&lt;br /&gt;
=== Testing tools and frameworks ⌘===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Karma&amp;#039;&amp;#039;&amp;#039; - the &amp;#039;&amp;#039;&amp;#039;test runner&amp;#039;&amp;#039;&amp;#039; for JavaScript&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Protractor&amp;#039;&amp;#039;&amp;#039; - the end-to-end &amp;#039;&amp;#039;&amp;#039;testing framework&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Jasmine&amp;#039;&amp;#039;&amp;#039; - the &amp;#039;&amp;#039;&amp;#039;behavior-driven&amp;#039;&amp;#039;&amp;#039; JavaScript &amp;#039;&amp;#039;&amp;#039;testing framework&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Jest&amp;#039;&amp;#039;&amp;#039; - no config, supportive, snapshotting, isolated&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Mocha&amp;#039;&amp;#039;&amp;#039; - the JavaScript &amp;#039;&amp;#039;&amp;#039;testing framework&amp;#039;&amp;#039;&amp;#039; (for nodejs)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;QUnit&amp;#039;&amp;#039;&amp;#039; - the unit testing framework (for jQuery)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Selenium&amp;#039;&amp;#039;&amp;#039; - the tool that &amp;#039;&amp;#039;&amp;#039;automates&amp;#039;&amp;#039;&amp;#039; the web browsers&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;PhantomJS&amp;#039;&amp;#039;&amp;#039; - the &amp;#039;&amp;#039;&amp;#039;headless&amp;#039;&amp;#039;&amp;#039; webkit browser&lt;br /&gt;
&lt;br /&gt;
=== Tools and frameworks ⌘===&lt;br /&gt;
* Help developers &amp;#039;&amp;#039;&amp;#039;write, run, and review&amp;#039;&amp;#039;&amp;#039; unit tests&lt;br /&gt;
* Commonly named as &amp;#039;&amp;#039;&amp;#039;xUnit&amp;#039;&amp;#039;&amp;#039; frameworks&lt;br /&gt;
** Share a &amp;#039;&amp;#039;&amp;#039;set of features&amp;#039;&amp;#039;&amp;#039; across implementations&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Alternatives&amp;#039;&amp;#039;&amp;#039; for writing single tests for developer/development tools in a browser&lt;br /&gt;
* Provide a lot of the &amp;#039;&amp;#039;&amp;#039;ready-made&amp;#039;&amp;#039;&amp;#039; piece of code&lt;br /&gt;
** test suite/case &amp;#039;&amp;#039;&amp;#039;aggregation&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;assertions&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;mock/stub&amp;#039;&amp;#039;&amp;#039; helpers, &amp;#039;&amp;#039;&amp;#039;asynchronous&amp;#039;&amp;#039;&amp;#039; testing implementation, and more&lt;br /&gt;
&lt;br /&gt;
=== Tools and frameworks con&amp;#039;t ⌘===&lt;br /&gt;
Collecting all the tests into &amp;#039;&amp;#039;&amp;#039;suites&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;test cases&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Test suites and test cases are part of many files&lt;br /&gt;
** Each test file typically contains tests for a &amp;#039;&amp;#039;&amp;#039;single module&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* Normally, grouping all tests for a module in one test suite is considered as the best practice&lt;br /&gt;
* The &amp;#039;&amp;#039;&amp;#039;suite&amp;#039;&amp;#039;&amp;#039; can contain &amp;#039;&amp;#039;&amp;#039;many test cases&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** Each test case includes testing of &amp;#039;&amp;#039;&amp;#039;small aspects of any module&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== Pre and after setup ⌘===&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Built-in&amp;#039;&amp;#039;&amp;#039; functions provided at the suite and test-case levels&lt;br /&gt;
* Help easily handle any &amp;#039;&amp;#039;&amp;#039;pretest&amp;#039;&amp;#039;&amp;#039; setup and post-test &amp;#039;&amp;#039;&amp;#039;teardown&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
** setting and resetting the state of a database, initial values for variables, etc&lt;br /&gt;
* Oftenly named&lt;br /&gt;
** &amp;#039;&amp;#039;beforeEach()&amp;#039;&amp;#039;: runs before each test&lt;br /&gt;
** &amp;#039;&amp;#039;afterEach()&amp;#039;&amp;#039;: runs after each test&lt;br /&gt;
** &amp;#039;&amp;#039;before()&amp;#039;&amp;#039;: runs before all tests and executes only once&lt;br /&gt;
** &amp;#039;&amp;#039;after()&amp;#039;&amp;#039;: runs after all tests&lt;br /&gt;
&lt;br /&gt;
== Setting up the Testing Environment ⌘==&lt;br /&gt;
* Downloading and installing the libraries&lt;br /&gt;
* Installing and configuring an IDE&lt;br /&gt;
* Setting up a sample application&lt;br /&gt;
&lt;br /&gt;
== Writing Your First Unit Test ⌘==&lt;br /&gt;
* Setting up a test&lt;br /&gt;
* Writing a test definition&lt;br /&gt;
* Working with nested scoping&lt;br /&gt;
* Creating assertions&lt;br /&gt;
* Running the unit test&lt;br /&gt;
&lt;br /&gt;
== Debugging the unit test ⌘==&lt;br /&gt;
* Stepping through the code&lt;br /&gt;
* Creating breakpoints&lt;br /&gt;
* Setting up debug tasks&lt;br /&gt;
&lt;br /&gt;
== Expanding the Unit Test ⌘==&lt;br /&gt;
* Writing a complex Javascript class&lt;br /&gt;
* Writing stubs and mocks&lt;br /&gt;
* Creating a Test Suite&lt;br /&gt;
&lt;br /&gt;
== Implementing TDD and BDD ⌘==&lt;br /&gt;
* Creating automated specifications&lt;br /&gt;
* Collaborating with users and testers&lt;br /&gt;
&lt;br /&gt;
== Writing More Tests ⌘==&lt;br /&gt;
* Testing &amp;#039;&amp;#039;&amp;#039;Node.js&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
* HTTP &amp;#039;&amp;#039;&amp;#039;endpoint&amp;#039;&amp;#039;&amp;#039; unit tests&lt;br /&gt;
* Testing a &amp;#039;&amp;#039;&amp;#039;REST&amp;#039;&amp;#039;&amp;#039; APIs&lt;br /&gt;
* Writing an &amp;#039;&amp;#039;&amp;#039;integration&amp;#039;&amp;#039;&amp;#039; test&lt;br /&gt;
* Testing &amp;#039;&amp;#039;&amp;#039;React&amp;#039;&amp;#039;&amp;#039; components (optional)&lt;br /&gt;
* Testing &amp;#039;&amp;#039;&amp;#039;Angular&amp;#039;&amp;#039;&amp;#039; components (optional)&lt;br /&gt;
&lt;br /&gt;
=== Testing React ⌘===&lt;br /&gt;
* [[Reactjs_basics#Testing_your_React_web_application_.E2.8C.98 | React]]&lt;br /&gt;
&lt;br /&gt;
=== Testing Angular ⌘===&lt;br /&gt;
* [[Angular_Fundamentals#Testing_JS_.E2.8C.98 | Angular]]&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ⌘==&lt;/div&gt;</summary>
		<author><name>Lsokolowski</name></author>
	</entry>
</feed>