Skip to content

Commit 887274a

Browse files
committed
decks: Go write tests using using pragmatic best practices
Signed-off-by: Edward Haas <[email protected]>
1 parent b9beee6 commit 887274a

File tree

8 files changed

+578
-0
lines changed

8 files changed

+578
-0
lines changed
347 KB
Loading

decks/go_write_tests_using_pragmatic_best_practices/content.md

Lines changed: 501 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6+
7+
<title>Go Write Tests using Pragmatic Best Practices</title>
8+
<meta name="description" content="Tests are written to assure the correctness and quality of the solution they examine.
9+
Engineers write tests at different stages of the development cycle, starting at unit tests up to e2e tests.
10+
In fact, for every line of production code, multiple lines of test code is written.
11+
12+
Writing tests is no different from writing production code. In order to keep it running correctly and assist in detecting issues, it needs to be written in a way that can stand the test of time, provide the needed information on failures and be maintained for the project lifetime.
13+
14+
This talk presents test best practices which can be applied at all test stages.
15+
The practices are focused to help write good tests and provide the needed information for debugging and troubleshooting the issues detected.
16+
17+
While each language and test framework may present different properties and challenges, the practices are agnostic to a specific language/tool.
18+
19+
Examples will be given in Golang using Ginkgo/Gomega and in Python using PyTest.
20+
21+
The talk will cover:
22+
- Test structure
23+
- Test isolation
24+
- Test fixtures vs test body
25+
- Assertion
26+
- Traceability
27+
- Shared resources
28+
- Dead test (code)
29+
- Skipping, xfailing or not running
30+
- Parallel tests
31+
32+
The talk is based on the following blog post: https://ehaas.net/blog/tests-best-practices">
33+
34+
<link rel="stylesheet" href="../../css/reset.css">
35+
<link rel="stylesheet" href="../../css/reveal.css">
36+
<link rel="stylesheet" href="../../css/theme/black.css">
37+
38+
<!-- Theme used for syntax highlighting of code -->
39+
<link rel="stylesheet" href="../../lib/css/monokai.css">
40+
41+
<!-- Printing and PDF exports -->
42+
<script>
43+
var link = document.createElement( 'link' );
44+
link.rel = 'stylesheet';
45+
link.type = 'text/css';
46+
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
47+
document.getElementsByTagName( 'head' )[0].appendChild( link );
48+
</script>
49+
</head>
50+
<body>
51+
<div class="reveal">
52+
<div class="slides">
53+
<section data-markdown="content.md"
54+
data-separator-vertical="^\r?\n--\r?\n$"
55+
data-separator-notes="^note:">
56+
</section>
57+
</div>
58+
</div>
59+
60+
<script src="../../js/reveal.js"></script>
61+
62+
<script>
63+
// More info about config & dependencies:
64+
// - https://github.com/hakimel/reveal.js#configuration
65+
// - https://github.com/hakimel/reveal.js#dependencies
66+
Reveal.initialize({
67+
dependencies: [
68+
{ src: '../../plugin/markdown/marked.js' },
69+
{ src: '../../plugin/markdown/markdown.js' },
70+
{ src: '../../plugin/notes/notes.js', async: true },
71+
{ src: '../../plugin/highlight/highlight.js', async: true },
72+
{ src: '../../plugin/zoom-js/zoom.js', async: true }
73+
]
74+
});
75+
</script>
76+
</body>
77+
</html>
335 KB
Loading
106 KB
Loading
141 KB
Loading
85.6 KB
Loading
63.2 KB
Loading

0 commit comments

Comments
 (0)