Python Testing Cookbook pdf free download

 

Python Testing Cookbook pdf free download

Python Testing Cookbook pdf free download

Python Testing Cookbook pdf free download

Overview:

The Python interpreter can run Python programs that are saved in files, or interactively execute Python statements that are typed at the keyboard. Python comes with a program named IDLE that simplifies the process of
writing, executing, and testing programs.

In this book(Python Testing Cookbook pdf free download), we will use a high-level programming language called Python, which was developed in the early 1990s by Guido van Rossum. Van Rossum needed to carry out repetitive tasks for administering computer systems. He was dissatisfied with other available languages that were optimized for writing large and fast programs. He needed to write smaller programs that didn’t have to run at optimum speed.

Installing Python:

Before you can try any of the programs shown in this book, or write any programs of your own, you need to make sure that Python is installed on your computer and properly configured. If you are working in a computer lab, this has probably been done already. If you are using your own computer, you can follow the instructions in Appendix A to install Python from the accompanying CD.

The Python Interpreter:

You learned earlier that Python is an interpreted language. When you install the Python language on your computer, one of the items that is installed is the Python interpreter. The Python interpreter is a program that can read Python programming statements and execute them. (Sometimes we will refer to the Python interpreter simply as the interpreter.) You can use the interpreter in two modes: interactive mode and script mode. In interactive mode, the interpreter waits for you to type Python statements on the keyboard. Once you type a statement, the interpreter executes it and then waits for you to type another statement. In script mode, the interpreter reads the contents of a file that contains Python statements. Such a file is known as a Python program or a Python script. The interpreter executes each statement in the Python program as it reads it.

This ebook(Python Testing Cookbook pdf free download) contains these contents:

Contents:

Chapter 1: Using Unittest To Develop Basic Tests 5
Introduction 5
Asserting the basics 7
Setting up and tearing down a test harness 11
Running test cases from the command line with increased verbosity 14
Running a subset of test case methods 16
Chaining together a suite of tests 18
Defining test suites inside the test module 21
Retooling old test code to run inside unittest 25
Breaking down obscure tests into simple ones 29
Testing the edges 35
Testing corner cases by iteration 39
Chapter 2: Running Automated Test Suites with Nose 45
Introduction 45
Getting nosy with testing 46
Embedding nose inside Python 49
Writing a nose extension to pick tests based on regular expressions 52
Writing a nose extension to generate a CSV report 59
Writing a project-level script that lets you run different test suites 66
Chapter 3: Creating Testable Documentation with doctest 77
Introduction 77
Documenting the basics 78
Catching stack traces 82
Running doctests from the command line 85
Coding a test harness for doctest 88
Filtering out test noise 92

Printing out all your documentation including a status report 96
Testing the edges 101
Testing corner cases by iteration 104
Getting nosy with doctest 107
Updating the project-level script to run this chapter’s doctests 110
Chapter 4: Testing Customer Stories with Behavior
Driven Development 117
Introduction 117
Naming tests that sound like sentences and stories 120
Testing separate doctest documents 126
Writing a testable story with doctest 130
Writing a testable novel with doctest 136
Writing a testable story with Voidspace 142
Mock and nose 142
Writing a testable story with mockito and nose 147
Writing a testable story with Lettuce 150
Using Should DSL to write succinct assertions with Lettuce 158
Updating the project-level script to run this chapter’s BDD tests 163
Chapter 5: High Level Customer Scenarios with Acceptance Testing 169
Introduction 170
Installing Pyccuracy 172
Testing the basics with Pyccuracy 176
Using Pyccuracy to verify web app security 179
Installing the Robot Framework 183
Creating a data-driven test suite with Robot 186
Writing a testable story with Robot 191
Tagging Robot tests and running a subset 197
Testing web basics with Robot 204
Using Robot to verify web app security 208
Creating a project-level script to verify this chapter’s acceptance tests 212
Chapter 6: Integrating Automated Tests with Continuous Integration 217
Introduction 217
Generating a continuous integration report for Jenkins using NoseXUnit 220
Configuring Jenkins to run Python tests upon commit 222
Configuring Jenkins to run Python tests when scheduled 227
Generating a CI report for TeamCity using teamcity-nose 231
Configuring TeamCity to run Python tests upon commit 234
Configuring TeamCity to run Python tests when scheduled 237

Chapter 7: Measuring your Success with Test Coverage 241
Introduction 241
Building a network management application 243
Installing and running coverage on your test suite 251
Generating an HTML report using coverage 255
Generating an XML report using coverage 257
Getting nosy with coverage 259
Filtering out test noise from coverage 261
Letting Jenkins get nosy with coverage 264
Updating the project-level script to provide coverage reports 269
Chapter 8: Smoke/Load Testing—Testing Major Parts 275
Introduction 275
Defining a subset of test cases using import statements 277
Leaving out integration tests 281
Targeting end-to-end scenarios 285
Targeting the test server 290
Coding a data simulator 298
Recording and playing back live data in real time 303
Recording and playing back live data as fast as possible 311
Automating your management demo 319
Chapter 9: Good Test Habits for New and Legacy Systems 323
Introduction 324
Something is better than nothing 324
Coverage isn’t everything 326
Be willing to invest in test fixtures 328
If you aren’t convinced on the value of testing, your team
won’t be either 330
Harvesting metrics 331
Capturing a bug in an automated test 332
Separating algorithms from concurrency 333
Pause to refactor when test suite takes too long to run 334
Cash in on your confidence 336
Be willing to throw away an entire day of changes 337
Instead of shooting for 100 percent coverage, try to have a steady growth 339
Randomly breaking your app can lead to better code 340

Python Testing Cookbook pdf free download

Crash Course Pathology ebook free download pdf

Python Testing Cookbook pdf free download

Leave a Reply

Your email address will not be published. Required fields are marked *

*