Skip to content

Commit a7c38a8

Browse files
completed testing
1 parent 2da5513 commit a7c38a8

File tree

3 files changed

+61
-48
lines changed

3 files changed

+61
-48
lines changed

content/devops/testing.md

Lines changed: 60 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,17 @@
11
+++
2-
description = "Testing levels, Chrome DevTools, Error tracking"
2+
description = "TDD, Chrome DevTools, error tracking"
33
title = "Testing & Debugging"
44
draft = false
55
weight = 200
6-
bref="Software testing is an investigation conducted to provide stakeholders with information about the quality of the software product or service under test"
6+
bref="Software testing is an investigation conducted to provide stakeholders with information about the quality of the software product or service under test. Debugging is the process of finding and resolving defects or problems within a computer program that prevent correct operation of computer software or a system"
77
toc = true
88
script = 'animation'
99
+++
1010

11-
<h3 class="section-head" id="h-Section0"><a href="#h-Section0">Test Driven Development</a></h3>
12-
<div class="example">
13-
<dl>
14-
<dt>TBD</dt>
15-
<dd>TBD </dd>
16-
</dl>
17-
</div>
18-
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
19-
20-
<h3 class="section-head" id="h-Section1"><a href="#h-Section1">Testing Levels</a></h3>
21-
<div class="example">
22-
<dl>
23-
<dt>Unit, function, acceptance</dt>
24-
<dd>TBD </dd>
25-
</dl>
26-
</div>
27-
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
28-
29-
<h3 class="section-head" id="h-Section2"><a href="#h-Section2">Libraries</a></h3>
30-
<div class="example">
31-
<dl>
32-
<dt>Mocha, Jest, Sinon</dt>
33-
<dd>TBD </dd>
34-
</dl>
35-
</div>
36-
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
37-
38-
<h3 class="section-head" id="h-Section3"><a href="#h-Section3">Chrome DevTools</a></h3>
39-
<div class="example">
40-
<dl>
41-
<dt>TBD</dt>
42-
<dd>TBD </dd>
43-
</dl>
44-
</div>
45-
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
11+
<h3 class="section-head" id="h-Section1"><a href="#h-Section1">Test Driven Development</a></h3>
12+
<div class="example">
4613

47-
<h3 class="section-head" id="h-Section4"><a href="#h-Section4">Error tracking</a></h3>
48-
<div class="example">
49-
<dl>
50-
<dt>Logs, Sentry</dt>
51-
<dd>TBD </dd>
52-
</dl>
53-
</div>
54-
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
55-
56-
### Whenever possible, use TDD
14+
#### Whenever possible, use TDD
5715

5816
TDD is a _design process_, not a testing process. TDD is a robust way of designing software components ("units") interactively so that their behaviour is specified through unit tests.
5917

@@ -76,4 +34,58 @@ During phase 2, don't bother with quality.
7634
+ Fast feedback for the developers, you know that you don't break anything and that you are evolving the system in a good direction
7735
+ Generates confidence to add features, fix bugs, or explore new designs
7836

79-
Note that code written without a test-first approach is often very hard to test!
37+
Note that code written without a test-first approach is often very hard to test!
38+
</div>
39+
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
40+
41+
<h3 class="section-head" id="h-Section2"><a href="#h-Section2">Testing</a></h3>
42+
<div class="example">
43+
<dl>
44+
<dt>Unit testing</dt>
45+
<dd>Individual units/components of a software are tested. A unit is the smallest testable part of any software. It usually has one or a few inputs and usually a single output. </dd>
46+
<dt>Integration testing</dt>
47+
<dd>Individual software modules are combined and tested as a group. </dd>
48+
<dt>System testing</dt>
49+
<dd>A complete and integrated software is tested for compliance with the specified requirements. </dd>
50+
<dt>Acceptance testing</dt>
51+
<dd>A system is tested for acceptability and ready for delivery. </dd><br/>
52+
<div style="text-align:center">
53+
<img alt="Image" src="https://www.javascripter.co/img/devops/testing.svg">
54+
</div>
55+
<figcaption>
56+
The V-model of software development identifies testing tasks for each stage of development.
57+
</figcaption><br/>
58+
<dt><a href="/files/testing_articles/">A curated list of articles related to JavaScript testing</a></dt>
59+
<dd>Going over from everything from testing libraries, best practices, tips & tricks, and more. </dd>
60+
</dl>
61+
</div>
62+
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>
63+
64+
65+
<h3 class="section-head" id="h-Section3"><a href="#h-Section3">Debugging</a></h3>
66+
<div class="example">
67+
<dl>
68+
<dt>Types of errors</dt>
69+
<dd>
70+
<ol>
71+
<li><b>Syntax or interpretation errors</b> - These include mismatched or missing quotes, parentheses and braces, incorrect case, spelling mistakes, illegal characters, and more. These erros can usually be caught using linters like <ins>ESlint</ins> or <ins>JSLint</ins>. Linters analyze your code before it is executed and point out syntax and other common errors.</li>
72+
<li><b>Runtime exceptions</b> - These are the errors that occur when your JavaScript code executes. Such errors can be triggered by referring to an undefined variable, dividing by zero, by a failed “assert” statement, or by using a “throw” statement in your (or a JavaScript library’s) code to manually specify that an exception has occurred. When a runtime exception occurs, any JavaScript code after that line of code is not executed so they can leave your web page or application in an unexpected state. You can catch and handle runtime exceptions by wrapping the code that fails with a <mark>try {code}</mark> <mark>catch(exception) {}</mark> block.</li>
73+
<li><b>Incorrect logic</b> - does not show any errors but causes your code to not do what you intend it to. Debugging such errors requires some practice using debugging tools that your browser provides.</li>
74+
</ol></dd>
75+
<dt>Chrome DevTools</dt>
76+
<dd>
77+
<ul>
78+
<li><b>Console</b> - Use <mark>console.log()</mark> to dump statements and other useful information like stack variables. Use <mark>console.assert()</mark> to ensure that certain conditions or assumptions are being met in your code. This also dumps the execution call stack and continues execution after the assert.</li>
79+
<li><b>Debugger</b> - To specify a breakpoint, click on its line number in your code editor or in the Sources panel in <ins>Chrome DevTools</ins>. This will cause the debugger to pause at that line and allow you to inspect variables, the call stack, and evaluate expressions. With the debugger you can continue execution by stepping over the code line-by-line. You can set <ins>watches</ins> for variables and see how they change as you step over the code line by line. DevTools also has <ins>conditional breakpoints</ins> where you can specify the condition when the debugger stops execution.</li>
80+
<li><b>Working with APIs</b> - The Networks panel in DevTools shows you, for each network request, the “method” (e.g. GET, POST), the HTTP status code (e.g. 200, 403), the MIMEtype (e.g. application/json), the content’s size and whether the network request was fulfilled from the browser’s cache.</li>
81+
<li><b>Tips</b> - To ensure that your web page is using the latest version of your code, disable the browser cache in the DevTools settings. Also, when inspecting JavaScript objects, remember to use <mark>console.log(JSON.parse(JSON.stringify(obj)));</mark>.</li>
82+
<li><a href="https://developers.google.com/web/tools/chrome-devtools/">Official Documentation</a></li>
83+
</ul>
84+
</dd>
85+
<dt>Server-side debugging</dt>
86+
<dd>Logs - cloudwatch</dd>
87+
<dd>Instance health check</dd>
88+
<dd>Sentry.io</dd>
89+
</dl>
90+
</div>
91+
<div style="text-align:right"> <a href="#top">&#8593; Top</a></div>

static/img/devops/testing.png

-769 KB
Binary file not shown.

static/img/devops/testing.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)