• Complain

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.

it-ebooks Python Testing Tutorial
  • Book:
    Python Testing Tutorial
  • Author:
  • Publisher:
    iBooker it-ebooks
  • Genre:
  • Year:
    2018
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

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.

it-ebooks: author's other books


Who wrote Python Testing Tutorial? Find out the surname, the name of the author of the book and a list of all author's works by series.

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.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Table of Contents
  1. 1.1
  2. 1.2
  3. 1.3
  4. Exercises
  5. 2.1
  6. 2.2
  7. 2.3
  8. 2.4
  9. 2.5
  10. 2.6
  11. 2.7
  12. Instructions for Trainers
  13. 3.1
  14. 3.2
  15. 3.3
  16. 3.4
Recap Puzzle
Recap Puzzle

The rows in the table got messed up! Match the test strategies with the correct descriptions.

test strategydescription
Unit Testfiles and examples that help with testing
Acceptance Testcollection of tests for a software package
Mockrelative amount of code tested
Fixturetests a single module, class or function
Test suiteprepare tests and clean up afterwards
Test datareplaces a complex object to make testing simpler
Test coveragetests functionality from the users point of view

This exercise works better when each element from the table is printed on a paper card.

Fixtures
Fixtures
Exercise 1: A module for test data

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(): ...
Exercise 2: Using the fixture

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.

Exercise 3: Create more fixtures

Create fixtures for the two text corpora in the files mobydick_full.txt and mobydick_summary.txt as well.

Exercise 4: Fixtures from fixtures

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

Warming Up
Warming Up
How many words are in the following sentence?
The program works perfectly?

You will probably agree, that the sentence contains four words.


How many words are in the next sentence?
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.

What is automated testing good for?

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.
Python Testing Tutorial
Python Testing Tutorial
Overview

This tutorial helps you to learn automated testing in Python 3 using the py.test framework.

Latest version of this book Sources for this tutorial - photo 1

Latest version of this book
  • Sources for this tutorial: github.com/krother/python_testing_tutorial.
  • PDF and EPUB versions: www.gitbook.io/book/krother/python-testing-tutorial
Copyright

Feedback and comments are welcome at:

2018 Magdalena & Kristian Rother

Released under the conditions of a Creative CommonsAttribution License 4.0.

Contributors

Kristian Rother, Magdalena Rother, Daniel Szoska

Lesson Plan for a 180' tutorial
Lesson plan for a 180' tutorial

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.

moduletopictime
warm-upintroduce the Moby Dick theme5'
warm-upicebreaker activity5'
warm-upannounce training objectives5'
part 1Writing automatic tests in Python45
warm-upmethods in the unittest module5
new contentpresentation: Unit Tests, Integration Tests, and Acceptance Tests15
applicationchallenges 1.1 - 1.520
wrap-upQ & A5
part 2Integration and Acceptance Tests (45')
warm-upquiz on test strategies10'
new contentpresentation on Test-Driven-Development10
applicationchallenges 2.1 - 3.320'
wrap-upQ & A5
break10
part 3Tests data and test suites (45')
warm-upmultiple choice questions10'
new contentpresentation on test suites10
applicationexercises 4, 5, 620'
wrap-upQ & A5
summaryBenefits of testing (25')
transfergroup discussion on benefits of testing20
finishingsummary4
finishinggoodbye1'
Lesson Plan for a 45' tutorial
Lesson Plan for a 45' tutorial
Target audience

Programmers who have already written programs on their own but would like to learn about automated software testing.

Learning Objective

During the tutorial participants will implement automatic test functions that pass for the Moby Dick example. using the unittest module within 20'.

Lesson Plan
moduletopictime
warm-uphello1'
warm-upquestion: How do you know that your code works?4'
motivationexplain the benefit: You will be able to check in a few seconds that your program works.1
new contentoverview of the code example1
new contentrun the code example; collective analysis15'
applicationwrite code using the task description20'
wrap-updiscuss pros and cons of testing15'
wrap-uppoint to materials2'
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

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.


Reviews about «Python Testing Tutorial»

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.