We never have the time and the budget to do things right. But obviously we have the time and budget to do it often.
by the colleague of an ex-colleague
Why Agile Software Development Techniques Work: Improved Feedback
Manning Publications (2020) - Unit Testing Principles, Practices and Patterns
* if you don't go blind
public void testFindAll(){
final List <Role> list = repo.findAll()
Assert.assertNotNull(list);
for (final Role role : list) {
System.out.println(role);
}
}
@Test
void testThisClassWorksFine throws Exception{
// Arrange
final var job = FancyJob();
// Act
job.register();
// Assert
assertEquals(2021, job.getExecutionYear());
assertEquals(5, job.getExecutionMonth());
assertEquals(31, job.getExecutionDay());
assertEquals("1337,42", job.getCalculationResult());
}
@Test
void testShouldRecalculateByExecutionMonth
throws Exception{
// Arrange
RecalculationBatchJob.class
.getField("executionDate")
.set(job,"2020-29-05");
// Act
RecalculationBatchJob.class
.getMethod("register")
.invoke(job);
}
@Test
void testShouldRecalculateAllCostsByBaseCosts
throws Exception{
// Arrange
var job = new RecalculationBatchJob();
// Act
job.register();
// Assert
assertEquals(
getBaseCostsFrom("c:\\users\\documents\\accounts.json"),
job.getCalculatedCosts());
}
Acceptance
*UncleBob (2017) - TestDefinitions **Martin Fowler (2014) - Unittests by Martin Fowler
*UncleBob (2017) - TestDefinitions **Martin Fowler (2014) - Unittests by Martin Fowler
* explorative and other manual tests
@startuml
skinparam handwritten true
skinparam monochrome reverted
skinparam backgroundColor transparent
skinparam node{
backgroundColor<<A>> #FFFFFF
backgroundColor<<B>> #CCCCCC
backgroundColor<<C>> #999999
}
node A1 as "1"<<A>>
node A2 as "2"<<A>>
node A3 as "3"<<A>>
node B1 as "1"<<B>>
node B2 as "2"<<B>>
node B3 as "3"<<B>>
node C1 as "1"<<C>>
node C2 as "2"<<C>>
node C3 as "3"<<C>>
interface A as " "
interface B as " "
interface C as " "
A -[bold,#LightGray]-> A1
A -[bold,#LightGray]-> A2
A -[bold,#LightGray]-> A3
B -[bold,#darkGray]-> B1
B -[bold,#darkGray]-> B2
B -[bold,#darkGray]-> B3
C -[bold,#Gray]-> C1
C -[bold,#Gray]-> C2
C -[bold,#Gray]-> C3
@enduml
9 Tests
@startuml
skinparam handwritten true
skinparam monochrome reverted
skinparam backgroundColor transparent
skinparam node{
backgroundColor<<A>> #FFFFFF
backgroundColor<<B>> #CCCCCC
backgroundColor<<C>> #999999
}
node A1 as "1"<<A>>
node A2 as "2"<<A>>
node A3 as "3"<<A>>
node B1.1 as "1" <<B>>
node B2.1 as "2" <<B>>
node B3.1 as "3" <<B>>
node B1.2 as "1" <<B>>
node B2.2 as "2" <<B>>
node B3.2 as "3" <<B>>
node B1.3 as "1" <<B>>
node B2.3 as "2" <<B>>
node B3.3 as "3" <<B>>
node C1.1.1 as "1" <<C>>
node C2.1.1 as "2" <<C>>
node C3.1.1 as "3" <<C>>
node C1.1.2 as "1" <<C>>
node C2.1.2 as "2" <<C>>
node C3.1.2 as "3" <<C>>
node C1.1.3 as "1" <<C>>
node C2.1.3 as "2" <<C>>
node C3.1.3 as "3" <<C>>
node C1.2.1 as "1" <<C>>
node C2.2.1 as "2" <<C>>
node C3.2.1 as "3" <<C>>
node C1.2.2 as "1" <<C>>
node C2.2.2 as "2" <<C>>
node C3.2.2 as "3" <<C>>
node C1.2.3 as "1" <<C>>
node C2.2.3 as "2" <<C>>
node C3.2.3 as "3" <<C>>
node C1.3.1 as "1" <<C>>
node C2.3.1 as "2" <<C>>
node C3.3.1 as "3" <<C>>
node C1.3.2 as "1" <<C>>
node C2.3.2 as "2" <<C>>
node C3.3.2 as "3" <<C>>
node C1.3.3 as "1" <<C>>
node C2.3.3 as "2" <<C>>
node C3.3.3 as "3" <<C>>
interface A as " "
A -[bold,#white]-> A1
A -[bold,#white]-> A2
A -[bold,#white]-> A3
A1 -[bold,#white]-> B1.1
A1 -[bold,#white]-> B2.1
A1 -[bold,#white]-> B3.1
A2 -[bold,#white]-> B1.2
A2 -[bold,#white]-> B2.2
A2 -[bold,#white]-> B3.2
A3 -[bold,#white]-> B1.3
A3 -[bold,#white]-> B2.3
A3 -[bold,#white]-> B3.3
B1.1 -[bold,#white]-> C1.1.1
B1.1 -[bold,#white]-> C2.1.1
B1.1 -[bold,#white]-> C3.1.1
B2.1 -[bold,#white]-> C1.1.2
B2.1 -[bold,#white]-> C2.1.2
B2.1 -[bold,#white]-> C3.1.2
B3.1 -[bold,#white]-> C1.1.3
B3.1 -[bold,#white]-> C2.1.3
B3.1 -[bold,#white]-> C3.1.3
B1.2 -[bold,#white]-> C1.2.1
B1.2 -[bold,#white]-> C2.2.1
B1.2 -[bold,#white]-> C3.2.1
B2.2 -[bold,#white]-> C1.2.2
B2.2 -[bold,#white]-> C2.2.2
B2.2 -[bold,#white]-> C3.2.2
B3.2 -[bold,#white]-> C1.2.3
B3.2 -[bold,#white]-> C2.2.3
B3.2 -[bold,#white]-> C3.2.3
B1.3 -[bold,#white]-> C1.3.1
B1.3 -[bold,#white]-> C2.3.1
B1.3 -[bold,#white]-> C3.3.1
B2.3 -[bold,#white]-> C1.3.2
B2.3 -[bold,#white]-> C2.3.2
B2.3 -[bold,#white]-> C3.3.2
B3.3 -[bold,#white]-> C1.3.3
B3.3 -[bold,#white]-> C2.3.3
B3.3 -[bold,#white]-> C3.3.3
@enduml
27 Tests
Integrative vs. Unit
Code-Coverage vs. Test-Coverage
Branch "IntegrationUnitShowcase"
* We talk about exceptions later
Robert C. Martin (2018) - Clean Architecture
| signal type | timing factor | example with timing = 1 | example with timing = 3 |
|---|---|---|---|
| pause between words | 7 | 0000000 | 000000000000000000000 |
| pause between symbols | 3 | 000 | 000000000 |
| pause between dots/dashes | 1 | 0 | 000 |
| dashes | 3 | 111 | 111111111 |
| dot | 1 | 1 | 111 |