You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9b717c5
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: content/pages/04-web-development/38-testing.markdown
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,19 @@ correctness.
48
48
shows how to set unit tests and integration tests for a Flask example
49
49
application.
50
50
51
+
*[BDD Testing a Restful Web Application in Python](https://semaphoreci.com/community/tutorials/bdd-testing-a-restful-web-application-in-python)
52
+
is an introduction to behavior-driven development (BDD) and uses
53
+
a [Flask](/flask.html) web application as an example project for
54
+
learning.
55
+
56
+
*[Testing, for people who hate testing](https://eev.ee/blog/2016/08/22/testing-for-people-who-hate-testing/)
57
+
provides examples for how to improve your testing environment such
58
+
as using a new test harness and getting your test suite to run fast.
59
+
60
+
*[Getting started with Pytest](https://jacobian.org/writing/getting-started-with-pytest/)
61
+
goes over some code challenges as examples for how to use Pytest in
62
+
your own projects.
63
+
51
64
*[Good test, bad test](http://late.am/post/2015/04/20/good-test-bad-test.html)
52
65
explains the difference between a "good" test case and one that is not
53
66
as useful. Along the way the post breaks down some myths about common
@@ -59,6 +72,9 @@ correctness.
59
72
* Google has a [testing blog](http://googletesting.blogspot.com/) where
60
73
they write about various aspects of testing software at scale.
61
74
75
+
*[A beginner's guide to Python testing](https://miguelgfierro.com/blog/2018/a-beginners-guide-to-python-testing/)
76
+
covers test-driven development for unit, integration and smoke tests.
77
+
62
78
* Still confused about the difference between unit, functional and
63
79
integration tests? Check out this
64
80
[top answer on Stack Overflow](http://stackoverflow.com/questions/4904096/whats-the-difference-between-unit-functional-acceptance-and-integration-test)
@@ -70,3 +86,44 @@ correctness.
70
86
over standard unittest testing.
71
87
72
88
*[Distributed Testing with Selenium Grid and Docker](https://testdriven.io/distributed-testing-with-selenium-grid) shows how to distribute automated, browser tests with Selenium Grid and Docker Swarm. It also looks at how to run tests against a number of browsers and automate the provisioning and deprovisioning of machines to keep costs down.
89
+
90
+
*[Principles of Automated Testing](http://www.lihaoyi.com/post/PrinciplesofAutomatedTesting.html)
91
+
explains how to prioritize what to test, goes through some levels of
92
+
testing from [unit](/unit-testing.html) to
93
+
[integration](/integration-testing.html) and examines when to use example
94
+
and bulk tests.
95
+
96
+
97
+
### Mocking resources
98
+
Mocking allows you to isolate parts of your code under test and avoid
99
+
areas that are not critical to the tests you are writing. For example,
100
+
you may want to test how you handle text message responses but do not
101
+
want to actually receive text messages in your application. You can
102
+
mock a part of the code that would provide a happy-path scenario so
103
+
you can run your tests properly. The following resources show you how to
104
+
use mocks in your test cases.
105
+
106
+
*[Getting Started with Mocking in Python](https://semaphoreci.com/community/tutorials/getting-started-with-mocking-in-python)
107
+
provides a whole code example based on a blog project that shows
108
+
how to use `mock` when testing.
109
+
110
+
*[Python Mocking 101: Fake It Before You Make It](https://blog.fugue.co/2016-02-11-python-mocking-101.html)
111
+
explains what mocking is and is not, and shows how to use the `patch`
112
+
function to accomplish it in your project.
113
+
[Revisiting Unit Testing and Mocking in Python](https://blog.fugue.co/2017-07-18-revisiting-unit-testing-and-mocking-in-python.htmlZ)
114
+
is a follow-up post that expands upon using the `patch` function
115
+
along with dependency injection.
116
+
117
+
*[Mocks and Monkeypatching in Python](https://semaphoreci.com/community/tutorials/mocks-and-monkeypatching-in-python)
118
+
uses the `mock` and `monkeypatch` tools to show how to mock your
119
+
test cases.
120
+
121
+
*[Mock yourself, not your tests](http://hernantz.github.io/mock-yourself-not-your-tests.html)
122
+
examines when mocks are necessary and when they are not as useful
123
+
so you can avoid them in your test cases.
124
+
125
+
*[Mocking Redis & Expiration in Python](http://malexandre.fr/2017/10/08/mocking-redis--expiration-in-python/)
126
+
is a specific scenario where you would want to test your
127
+
[Redis](/redis.html)-dependent code but prefer to mock it rather than
128
+
ensure an installation and connection are present whenever you run
0 commit comments