Skip to content

Commit bb9ef85

Browse files
author
davidwilby
committed
rerder talk
1 parent e9acdc6 commit bb9ef85

File tree

1 file changed

+160
-158
lines changed

1 file changed

+160
-158
lines changed

index.qmd

Lines changed: 160 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,18 @@ Go to [menti.com](https://menti.com) and enter the code **8145 3365**
7373

7474
## Outline
7575

76-
* Why do we need good practice?
77-
* Git
78-
* GitHub
79-
* Testing
80-
* Environment & Dependency Management
76+
<br>
77+
78+
* Why do we need good practice? {{< fa solid magnifying-glass >}}
79+
80+
* Testing {{< fa solid flask >}}
81+
82+
* Environment & Dependency Management {{< fa solid seedling >}}
83+
84+
* Git {{< fa brands git-alt >}}
85+
86+
* GitHub {{< fa brands github-alt >}}
87+
8188

8289
##
8390

@@ -111,6 +118,154 @@ Credit: [Anna Krystalli](https://annakrystalli.me/rrresearchACCE20/slides/01_int
111118
Credit: [Private Eye](https://www.private-eye.co.uk/pictures/special_reports/justice-lost-in-the-post.pdf)
112119

113120

121+
# Testing
122+
123+
## Levels of testing
124+
125+
. . .
126+
127+
::: {.callout-note appearance="minimal"}
128+
129+
**Smoke Testing**:
130+
*Very* brief initial checks that ensures the basic requirements required to run the project hold. If these fail there is no point proceeding to additional levels of testing until they are fixed.
131+
132+
:::
133+
134+
. . .
135+
136+
::: {.callout-warning appearance="minimal"}
137+
138+
**Unit Testing**:
139+
*Individual units* of a codebase are tested, e.g. functions or methods. The purpose is to validate that each unit of the software performs as designed.
140+
141+
:::
142+
143+
. . .
144+
145+
::: {.callout-important appearance="minimal"}
146+
147+
**Integration Testing**:
148+
Individual units are combined and tested as a *group*. The purpose of this level of testing is to expose faults in the interaction between integrated units.
149+
150+
:::
151+
152+
. . .
153+
154+
::: {.callout-tip appearance="minimal"}
155+
156+
**System Testing**:
157+
A complete, integrated system is tested. The purpose of this test is to evaluate whether the *system as a whole* gives the correct outputs for given inputs.
158+
159+
:::
160+
161+
. . .
162+
163+
::: {.callout-caution appearance="minimal"}
164+
165+
**Acceptance Testing**:
166+
Evaluate the system’s compliance with the project requirements and assess whether it is acceptable for the purpose.
167+
168+
:::
169+
170+
<font size="3">From: [The Turing Way](https://the-turing-way.netlify.app/reproducible-research/testing.html)</font>
171+
172+
173+
## Test-driven development
174+
175+
<br>
176+
177+
. . .
178+
179+
(@) Write a test that fails
180+
181+
<br>
182+
183+
. . .
184+
185+
(@) Write code to make the test pass
186+
187+
<br>
188+
189+
. . .
190+
191+
(@) Refactor
192+
193+
. . .
194+
195+
196+
##
197+
```{mermaid}
198+
%%| fig-height: 7
199+
flowchart TB
200+
classDef writecode fill:#7D7ABC,stroke-width:0px;
201+
classDef testspass fill:#23F0C7,stroke-width:0px;
202+
classDef testsfail fill:#EF767A,stroke-width:0px;
203+
subgraph id1 [<b>Code-driven development</b>]
204+
A((1. write test)) --> B((2. test<br>passes/fails))
205+
B-->|test passes|A
206+
B-->|test fails|C((3. Write only<br>enough code))
207+
C-->|test fails|C
208+
end
209+
subgraph id2 [<b>Refactoring</b>]
210+
C-->|test passes|D((4. Check all tests))
211+
D-->|tests pass|E((5. Refactor))
212+
E-->D
213+
D-->|Some tests fail|F((6. Update failing tests<br>Correct regressions))
214+
F-->D
215+
end
216+
class A,C,E,F writecode;
217+
class B testsfail;
218+
class D testspass;
219+
```
220+
221+
# Environment & Dependency Management
222+
223+
## Python :snake:
224+
225+
<br>
226+
227+
```{mermaid}
228+
%%| fig-width: 9
229+
flowchart TB
230+
subgraph Project 3
231+
A[fab:fa-python Python 3.10]
232+
A-->B[numpy 1.24.0]
233+
A-->C[Django 4.0]
234+
A-->D[TensorFlow 2.11]
235+
end
236+
subgraph Project 2
237+
E[fab:fa-python Python 3.8]
238+
E-->F[numpy 1.1.0]
239+
E-->G[matplotlib 3.1]
240+
end
241+
subgraph Project 1
242+
H[fab:fa-python Python 3.10]
243+
H-->I[numpy 1.1.0]
244+
H-->J[matplotlib 3.1]
245+
end
246+
K[fab:fa-python System Python]
247+
```
248+
249+
. . .
250+
251+
<br>
252+
253+
`pip freeze`
254+
255+
```
256+
numpy==1.1.0
257+
matplotlib>3
258+
```
259+
`requirements.txt`
260+
<br>
261+
262+
::: {.callout-note appearance="simple"}
263+
264+
**Tools**: [`venv`](https://docs.python.org/3/library/venv.html) / [`pipenv`](https://pipenv.pypa.io/en/latest/) / [`conda`](https://docs.conda.io/en/latest/) / [`poetry`](https://python-poetry.org/)
265+
266+
:::
267+
268+
114269
# Control yourself
115270
Why you **need** version control
116271

@@ -525,164 +680,11 @@ Everyone makes mistakes.
525680
![](assets/images/github_projects_screenshot.png)
526681

527682

528-
# Testing
529-
530-
##
531-
532-
![](assets/images/post-office-scandal.png){fig-align="center"}
533-
534-
From: [Private Eye](https://www.private-eye.co.uk/pictures/special_reports/justice-lost-in-the-post.pdf)
535-
536-
537-
## Levels of testing
538-
539-
::: {.callout-note appearance="minimal"}
540-
541-
**Smoke Testing**:
542-
*Very* brief initial checks that ensures the basic requirements required to run the project hold. If these fail there is no point proceeding to additional levels of testing until they are fixed.
543-
544-
:::
545-
546-
. . .
547-
548-
::: {.callout-warning appearance="minimal"}
549-
550-
**Unit Testing**:
551-
*Individual units* of a codebase are tested, e.g. functions or methods. The purpose is to validate that each unit of the software performs as designed.
552-
553-
:::
554-
555-
. . .
556-
557-
::: {.callout-important appearance="minimal"}
558-
559-
**Integration Testing**:
560-
Individual units are combined and tested as a *group*. The purpose of this level of testing is to expose faults in the interaction between integrated units.
561-
562-
:::
563-
564-
. . .
565-
566-
::: {.callout-tip appearance="minimal"}
567-
568-
**System Testing**:
569-
A complete, integrated system is tested. The purpose of this test is to evaluate whether the *system as a whole* gives the correct outputs for given inputs.
570-
571-
:::
572-
573-
. . .
574-
575-
::: {.callout-caution appearance="minimal"}
576-
577-
**Acceptance Testing**:
578-
Evaluate the system’s compliance with the project requirements and assess whether it is acceptable for the purpose.
579-
580-
:::
581-
582-
<font size="3">From: [The Turing Way](https://the-turing-way.netlify.app/reproducible-research/testing.html)</font>
583-
584-
585-
## Test-driven development
586-
587-
<br>
588-
589-
. . .
590-
591-
(@) Write a test that fails
592-
593-
<br>
594-
595-
. . .
596-
597-
(@) Write code to make the test pass
598-
599-
<br>
600-
601-
. . .
602-
603-
(@) Refactor
604-
605-
. . .
606-
607-
608-
##
609-
```{mermaid}
610-
%%| fig-height: 7
611-
flowchart TB
612-
classDef writecode fill:#7D7ABC,stroke-width:0px;
613-
classDef testspass fill:#23F0C7,stroke-width:0px;
614-
classDef testsfail fill:#EF767A,stroke-width:0px;
615-
subgraph id1 [<b>Code-driven development</b>]
616-
A((1. write test)) --> B((2. test<br>passes/fails))
617-
B-->|test passes|A
618-
B-->|test fails|C((3. Write only<br>enough code))
619-
C-->|test fails|C
620-
end
621-
subgraph id2 [<b>Refactoring</b>]
622-
C-->|test passes|D((4. Check all tests))
623-
D-->|tests pass|E((5. Refactor))
624-
E-->D
625-
D-->|Some tests fail|F((6. Update failing tests<br>Correct regressions))
626-
F-->D
627-
end
628-
class A,C,E,F writecode;
629-
class B testsfail;
630-
class D testspass;
631-
```
632-
633683
## Continuous integration/Automated testing
634684

635685
![](assets/images/githubactions_screenshot.png){fig-align="center"}
636686

637687

638-
# Environment & Dependency Management
639-
640-
## Python :snake:
641-
642-
<br>
643-
644-
```{mermaid}
645-
%%| fig-width: 9
646-
flowchart TB
647-
subgraph Project 3
648-
A[fab:fa-python Python 3.10]
649-
A-->B[numpy 1.24.0]
650-
A-->C[Django 4.0]
651-
A-->D[TensorFlow 2.11]
652-
end
653-
subgraph Project 2
654-
E[fab:fa-python Python 3.8]
655-
E-->F[numpy 1.1.0]
656-
E-->G[matplotlib 3.1]
657-
end
658-
subgraph Project 1
659-
H[fab:fa-python Python 3.10]
660-
H-->I[numpy 1.1.0]
661-
H-->J[matplotlib 3.1]
662-
end
663-
K[fab:fa-python System Python]
664-
```
665-
666-
. . .
667-
668-
<br>
669-
670-
`pip freeze`
671-
672-
```
673-
numpy==1.1.0
674-
matplotlib>3
675-
```
676-
`requirements.txt`
677-
<br>
678-
679-
::: {.callout-note appearance="simple"}
680-
681-
**Tools**: [`venv`](https://docs.python.org/3/library/venv.html) / [`pipenv`](https://pipenv.pypa.io/en/latest/) / [`conda`](https://docs.conda.io/en/latest/) / [`poetry`](https://python-poetry.org/)
682-
683-
:::
684-
685-
686688
## Great resources
687689

688690
[![](assets/images/bes_reproducible_code.jpg)](https://www.britishecologicalsociety.org/wp-content/uploads/2019/06/BES-Guide-Reproducible-Code-2019.pdf)

0 commit comments

Comments
 (0)