Skip to content

Commit e8a195e

Browse files
author
davidwilby
committed
add material on testing
1 parent 80683aa commit e8a195e

File tree

1 file changed

+97
-17
lines changed

1 file changed

+97
-17
lines changed

index.qmd

Lines changed: 97 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The most important concept in git is the `commit` - the name given to a unit of
217217
C(fa:fa-plus <br><strong>Stage</strong><br>changes) --> D(fa:fa-check<br>Commit)
218218
```
219219

220-
## Aside: the commit hash
220+
## The commit hash
221221

222222
<br>
223223

@@ -246,6 +246,47 @@ But are most often seen as the first 7 characters, as this is easier to read/typ
246246
`d3dd03f`
247247

248248

249+
## The commit message
250+
251+
Each commit has a *message* associated with it.
252+
253+
<br>
254+
255+
**Summary/Title**: <50-72 characters
256+
257+
Displayed most frequently.
258+
259+
<br>
260+
261+
**Detailed description**: no character limit.
262+
263+
*Can* be used to capture more detail. Not used that often.
264+
265+
. . .
266+
267+
<br>
268+
269+
### This commit will...
270+
271+
::: columns
272+
273+
::: {.column width="30%"}
274+
275+
* :x: some stuff
276+
* :x: code
277+
* :x: updates
278+
279+
:::
280+
281+
::: {.column width="70%"}
282+
283+
* :heavy_check_mark: add new module "renderers"
284+
* :heavy_check_mark: update README with new install instructions
285+
* :heavy_check_mark: fix bug #17 with package update
286+
287+
:::
288+
289+
:::
249290

250291
## Branches {{< fa solid code-branch >}}
251292

@@ -274,7 +315,7 @@ git commit
274315
```
275316

276317

277-
::: {.callout-note appearance="simple"}
318+
::: {.callout-tip appearance="simple"}
278319

279320
**Checkout**: switching to a different branch.
280321

@@ -331,7 +372,7 @@ or
331372

332373
<br>
333374

334-
::: {.callout-note appearance="simple"}
375+
::: {.callout-tip appearance="simple"}
335376

336377
Once a directory/folder is *initialised* with `git` it becomes a *repository*.
337378

@@ -488,39 +529,78 @@ Everyone makes mistakes.
488529
Eye](https://www.private-eye.co.uk/pictures/special_reports/justice-lost-in-the-post.pdf)</font>
489530

490531

491-
##
492-
### Testing can be split into different scales
532+
## Levels of testing
493533

494-
<br>
534+
::: {.callout-note appearance="simple"}
495535

496-
::: {.callout-note}
536+
**Smoke Testing**
537+
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.
497538

498-
## Unit Testing
539+
:::
499540

500-
Tests the smallest possible units of code, e.g. functions or class methods.
541+
::: {.callout-note appearance="simple"}
542+
543+
**Unit Testing** A level of the software testing process where individual units of a software are tested. The purpose is to validate that each unit of the software performs as designed.
501544

502545
:::
503546

504-
<br>
547+
::: {.callout-note appearance="simple"}
505548

506-
::: {.callout-note}
549+
**Integration Testing** A level of software testing where 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.
507550

508-
## Integration Testing
551+
:::
552+
553+
::: {.callout-note appearance="simple"}
509554

510-
Test for errors when units function together.
555+
**System Testing** A level of the software testing process where 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.
511556

512557
:::
513558

514-
<br>
559+
::: {.callout-note appearance="simple"}
560+
561+
**Acceptance Testing** A level of the software testing process where a system is tested for acceptability. The purpose of this test is to evaluate the system’s compliance with the project requirements and assess whether it is acceptable for the purpose.
515562

516-
::: {.callout-note}
563+
:::
564+
565+
From: [The Turing Way](https://the-turing-way.netlify.app/reproducible-research/testing.html)
517566

518-
## Regression Testing
519567

520-
Tests that new functionality doesn't break existing functionality.
568+
## Test-driven development
521569

570+
::: {.incremental}
571+
1. Write a test that fails
572+
2. Write code to make the test pass
573+
3. Refactor
522574
:::
523575

576+
. . .
577+
578+
579+
##
580+
```{mermaid}
581+
%%| fig-height: 7
582+
flowchart TB
583+
classDef writecode fill:#7D7ABC,stroke-width:0px;
584+
classDef testspass fill:#23F0C7,stroke-width:0px;
585+
classDef testsfail fill:#EF767A,stroke-width:0px;
586+
subgraph id1 [<b>Code-driven development</b>]
587+
A((1. write test)) --> B((2. test<br>passes/fails))
588+
B-->|test passes|A
589+
B-->|test fails|C((3. Write only<br>enough code))
590+
C-->|test fails|C
591+
end
592+
subgraph id2 [<b>Refactoring</b>]
593+
C-->|test passes|D((4. Check all tests))
594+
D-->|tests pass|E((5. Refactor))
595+
E-->D
596+
D-->|Some tests fail|F((6. Update failing tests<br>Correct regressions))
597+
F-->D
598+
end
599+
class A,C,E,F writecode;
600+
class B testsfail;
601+
class D testspass;
602+
```
603+
524604

525605
# Environment & Dependency Management
526606

0 commit comments

Comments
 (0)