it-ebooks - Python Testing Tutorial
Here you can read online it-ebooks - Python Testing Tutorial full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: iBooker it-ebooks, genre: Children. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:
Romance novel
Science fiction
Adventure
Detective
Science
History
Home and family
Prose
Art
Politics
Computer
Non-fiction
Religion
Business
Children
Humor
Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.
Python Testing Tutorial: summary, description and annotation
We offer to read an annotation, description, summary or preface (depends on what the author of the book "Python Testing Tutorial" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.
Python Testing Tutorial — read online for free the complete book (whole text) full work
Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Python Testing Tutorial" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.
Font size:
Interval:
Bookmark:
- 1.1
- 1.2
- 1.3
- Exercises
- 2.1
- 2.2
- 2.3
- 2.4
- 2.5
- 2.6
- 2.7
- Instructions for Trainers
- 3.1
- 3.2
- 3.3
- 3.4
The rows in the table got messed up! Match the test strategies with the correct descriptions.
test strategy | description |
---|---|
Unit Test | files and examples that help with testing |
Acceptance Test | collection of tests for a software package |
Mock | relative amount of code tested |
Fixture | tests a single module, class or function |
Test suite | prepare tests and clean up afterwards |
Test data | replaces a complex object to make testing simpler |
Test coverage | tests functionality from the users point of view |
This exercise works better when each element from the table is printed on a paper card.
Create a new module conftest.py
with a string variable that contains a sentence with lots of special characters:
sample = """That #&%$* program still doesn't work!I already de-bugged it 3 times, and still numpy.array keeps raising AttributeErrors. What should I do?"""
Create a function that returns a mobydick.TextCorpus
object with the sample text above. Use the following as a header:
@pytest.fixturedef sample_corpus(): ...
Now create a module test_sample.py
with a function that uses the fixture:
def test_sample_text(sample_corpus): assert sample_corpus.n_words == 77
Execute the module with pytest
. Note that you do not need to import conftest
. Pytest does that automatically.
Create fixtures for the two text corpora in the files mobydick_full.txt
and mobydick_summary.txt
as well.
Create a fixture in conftest.py
that uses another fixture:
from mobydick import WordCounter@pytest.fixturedef counter(mobydick_summary): return WordCounter(mobydick_summary)
Write a simple test that makes sure the fixture is not None
The program works perfectly?
You will probably agree, that the sentence contains four words.
That #&%$* program still doesn't work!\nI already de-bugged it 3 times, and still numpy.array keeps raising AttributeErrors. What should I do?
You may find the answer to this question less obvious. It depends on how precisely the special characters are interpreted.
Writing automated tests for your software helps you to:
- get clear on what you want the program to do.
- identify gaps in the requirements.
- prove the presence of bugs (not their absence!).
- help you during refactoring.
This tutorial helps you to learn automated testing in Python 3 using the py.test
framework.
- Sources for this tutorial: github.com/krother/python_testing_tutorial.
- PDF and EPUB versions: www.gitbook.io/book/krother/python-testing-tutorial
Feedback and comments are welcome at:
2018 Magdalena & Kristian Rother
Released under the conditions of a Creative CommonsAttribution License 4.0.
Kristian Rother, Magdalena Rother, Daniel Szoska
I used a very similar lesson plan to conduct a training at EuroPython 2014. The audience consisted of about 60 Python programmers, including beginners and seasoned developers.
module | topic | time |
---|---|---|
warm-up | introduce the Moby Dick theme | 5' |
warm-up | icebreaker activity | 5' |
warm-up | announce training objectives | 5' |
part 1 | Writing automatic tests in Python | 45 |
warm-up | methods in the unittest module | 5 |
new content | presentation: Unit Tests, Integration Tests, and Acceptance Tests | 15 |
application | challenges 1.1 - 1.5 | 20 |
wrap-up | Q & A | 5 |
part 2 | Integration and Acceptance Tests (45') | |
warm-up | quiz on test strategies | 10' |
new content | presentation on Test-Driven-Development | 10 |
application | challenges 2.1 - 3.3 | 20' |
wrap-up | Q & A | 5 |
break | 10 | |
part 3 | Tests data and test suites (45') | |
warm-up | multiple choice questions | 10' |
new content | presentation on test suites | 10 |
application | exercises 4, 5, 6 | 20' |
wrap-up | Q & A | 5 |
summary | Benefits of testing (25') | |
transfer | group discussion on benefits of testing | 20 |
finishing | summary | 4 |
finishing | goodbye | 1' |
Programmers who have already written programs on their own but would like to learn about automated software testing.
During the tutorial participants will implement automatic test functions that pass for the Moby Dick example. using the unittest module within 20'.
module | topic | time |
---|---|---|
warm-up | hello | 1' |
warm-up | question: How do you know that your code works? | 4' |
motivation | explain the benefit: You will be able to check in a few seconds that your program works. | 1 |
new content | overview of the code example | 1 |
new content | run the code example; collective analysis | 15' |
application | write code using the task description | 20' |
wrap-up | discuss pros and cons of testing | 15' |
wrap-up | point to materials | 2' |
Font size:
Interval:
Bookmark:
Similar books «Python Testing Tutorial»
Look at similar books to Python Testing Tutorial. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.
Discussion, reviews of the book Python Testing Tutorial and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.