Search Header Logo
Áp dụng Tests với iOS

Áp dụng Tests với iOS

Assessment

Presentation

Professional Development

Professional Development

Easy

Created by

Đào Royce

Used 3+ times

FREE Resource

91 Slides • 6 Questions

1

Áp dụng Tests với iOS

By Đào FnB

2

The test pyramid

Some text here about the topic of discussion

media

3

"A measure to check if the code meets the defined specifications." 

​Test

4

Multiple Choice

What is a test?

1

A measure to increase code coverage

2

A measure to check if the code meets the defined specifications

3

A measure to check if the code is visually beautiful

4

A measure to check if the code contains security vulnerabilities?

5

Multiple Choice

What is the most basic type of developer level test?

1

Integration Test

2

Basic Test

3

Unit Test

4

UI Test

6

The Art of Unit Testing

" A unit test is a piece of code that invokes a unit of work and checks one specific end result of that unit of work.”

7

​Unit Test Structure

func testArraySorting() {

let input = [1, 7, 6, 3, 10]

let output = input.sorted()

XCTAssertEqual(output, [1, 3, 6, 7, 10])

}

Run the code

​Prepare Input

Output

8

Testable code

9

​Characteristic of Testable code

Control over inputs

Visibility into outputs

No hidden state

10

Multiple Choice

Question image

Testable code?

1

YES

2

NO

11

media

12

media

13

media

14

media

15

media

16

media

17

media

18

media

19

media

20

media

21

media

22

media

23

media

24

media

25

media

26

media

27

media

28

​Testability Techniques

Protocols and parameterization

Separating logic and effects

29

media

30

media

31

media

32

media

33

media

34

media

35

media

36

media

37

media

38

media

39

media

40

media

41

media

42

media

43

media

44

media

45

media

46

media

47

media

48

media

49

media

50

media

51

media

52

media

53

media

54

media

55

media

56

media

57

media

58

  • Reduce references to shared instances

  • Accept parameterized input

  • Introduce a protocol Create a testing implementation

​​Protocols and Parameterization

59

​Separating Logic and Effects

60

media

61

media

62

media

63

media

64

media

65

media

66

media

67

media

68

media

69

media

70

media

71

media

72

media

73

media

74

media

75

media

76

media

77

media

78

media

79

media

80

media

81

media

82

media

83

media

84

media

85

media

86

media

87

media

88

media

89

  • Extract algorithms

  • Functional style with value types

  • Thin layer on top to execute effects

​Separating Logic and Effects

90

​Testability Techniques

Protocols and parameterization

Separating logic and effects

91

Fill in the Blank

1. Protocols and parameterization

2. Separating _____ and effects

92

Test driven development

Red: Writing a failing test.

Green: Writing just enough code to make the test pass.

Refactor: Cleaning up and optimizing your code.

media

93

Multiple Choice

____: Writing just enough code to make the test pass

1

Refactor

2

GREEN

3

RED

94

Demo

media

95

5:00 a.m.--11:59 a.m.

Good morning.

12:00 p.m.--4:59 p.m.

Good afternoon.

5:00 p.m.--4:59 a.m.

Good evening.

Time-of-Day Greeter

96

Multiple Choice

Which of the following is not a stage in TDD?

1

RED

2

GREEN

3

COMMIT

4

REFACTOR

97

media

Áp dụng Tests với iOS

By Đào FnB

Show answer

Auto Play

Slide 1 / 97

SLIDE

Discover more resources for Professional Development