新书报道
当前位置: 首页 >> 电类优秀教材 >> 正文
Testing Python : Applying Unit Testing, TDD, BDD and Acceptance Testing
发布日期:2015-12-03  浏览

Testing Python : Applying Unit Testing, TDD, BDD and Acceptance Testing

[BOOK DESCRIPTION]

Fundamental testing methodologies applied to the popular Python language Testing Python; Applying Unit Testing, TDD, BDD and Acceptance Testing is the most comprehensive book available on testing for one of the top software programming languages in the world. Python is a natural choice for new and experienced developers, and this hands-on resource is a much needed guide to enterprise-level testing development methodologies. The book will show you why Unit Testing and TDD can lead to cleaner, more flexible programs. Unit Testing and Test-Driven Development (TDD) are increasingly must-have skills for software developers, no matter what language they work in. In enterprise settings, it's critical for developers to ensure they always have working code, and that's what makes testing methodologies so attractive. This book will teach you the most widely used testing strategies and will introduce to you to still others, covering performance testing, continuous testing, and more.Learn Unit Testing and TDD--important development methodologies that lie at the heart of Agile development Enhance your ability to work with Python to develop powerful, flexible applications with clean code Draw on the expertise of author David Sale, a leading UK developer and tech commentator Get ahead of the crowd by mastering the underappreciated world of Python testing Knowledge of software testing in Python could set you apart from Python developers using outmoded methodologies. Python is a natural fit for TDD and Testing Python is a must-read text for anyone who wants to develop expertise in Python programming.


[TABLE OF CONTENTS]

Introduction                                       1  (4)
Chapter 1 A History of Testing                     5  (10)
  You Do Test, Don't You?                          7  (1)
  Fundamentals and Best Practices                  7  (5)
    Python Installation                            8  (1)
      Linux                                        8  (1)
      Mac                                          8  (1)
      Windows                                      8  (1)
    Pip                                            9  (1)
    Virtualenv                                     9  (1)
    Source Control (SVN, Git)                      10 (1)
    Interactive Development Environment (IDE)      11 (1)
  Summary                                          12 (3)
Chapter 2 Writing Unit Tests                       15 (18)
  What Is Unit Testing?                            15 (2)
  What Should You Test?                            17 (1)
  Writing Your First Unit Test                     17 (5)
    Checking Values with the assertEquals Method   18 (2)
    Checking Exception Handling with               20 (2)
    assertRaises
  Following the PEP-8 Standard                     22 (1)
  Unit Test Structure                              23 (1)
  Additional Unit Test Examples                    24 (3)
    Getting Clever with assertRaises               24 (1)
    Making Your Life Easier with setUp             25 (2)
  Useful Methods in Unit Testing                   27 (5)
      assertEqual(x, y, msg=None)                  27 (1)
      assertAlmostEqual(x, y, places=None,         27 (1)
      msg=None, delta=None)
      assertRaises(exception, method,              28 (1)
      arguments, msg=None)
      assertDictContainsSubset(expected,           28 (1)
      actual, msg=None)
      assertDictEqual(dl, d2, msg=None)            28 (1)
      assertTrue(expr, msg=None)                   28 (1)
      assertFalse(expr, msg=None)                  29 (1)
      assertGreater(a, b, msg=None)                29 (1)
      assertGreaterEqual(a, b, msg=None)           29 (1)
      assertIn(member, container, msg=None)        30 (1)
      assertIs(exprl, expr2)                       30 (1)
      assertIsInstance(obj, class, msg=None)       30 (1)
      assertNotIsInstance(obj, class, msg=None)    30 (1)
      assertIsNone(obj, msg=None)                  30 (1)
      assertIsNot(exprl, expr2, msg=None)          31 (1)
      assertIsNotNone(obj, msg=None)               31 (1)
      assertLess(a, b, msg=None)                   31 (1)
      assertLessEqual(a, b, msg=None)              31 (1)
      assertItemsEqual(a, b, msg=None)             31 (1)
      assertRaises(excClass, callableObj,          32 (1)
      *args, **kwargs, msg=None)
  Summary                                          32 (1)
Chapter 3 Utilizing Unit Test Tools                33 (22)
  Using Python's Nose                              33 (7)
    Installing Nose                                34 (1)
    Using Nose's Best Features                     35 (5)
      Running Specific Test Files                  35 (1)
      Getting More Detail with Verbose             35 (1)
      Debugging Support with PDB                   36 (2)
      Checking Your Coverage                       38 (1)
      Coloring your tests with Rednose             39 (1)
  PyTest: An Alternative Test Runner               40 (6)
    Installing PyTest                              40 (1)
    PyTest's Best Features                         41 (5)
      Running Specific Tests                       41 (1)
      Viewing Detail with Verbose and Summary      42 (1)
      Debugging with PDB                           43 (2)
      Checking Your Coverage with PyTest           45 (1)
    Choosing Between Nose and PyTest               46 (1)
  Mock and Patch Tricky Situations                 46 (1)
  Installing the Mock Library                      47 (1)
  Mocking a Class and Method Response              47 (3)
  When Mock Won't Do, Patch!                       50 (3)
    The Requests Library                           50 (1)
    Patch in Action                                50 (2)
    Advanced Mocking                               52 (1)
  Summary                                          53 (2)
Chapter 4 Writing Testable Docwnentation           55 (12)
  Writing Your First Doctest                       56 (6)
    The Python Shell                               56 (1)
    Adding Doctests to a Method                    57 (1)
    Running Your Doctests                          58 (1)
    Handling Error Cases                           59 (2)
    Advanced Doctest Usage                         61 (1)
  Improving Doctests with Nose Integration         62 (3)
  Summary                                          65 (1)
  Resources                                        65 (2)
Chapter 5 Driving Your Development with Tests      67 (18)
  Agile Development                                67 (3)
    Adopting the Agile Process Now                 68 (2)
  Ethos of Test Driven Development                 70 (2)
  Advantages of Test Driven Development            72 (1)
  Ping-Pong Programming                            72 (1)
  Test Driving Your Problem                        73 (9)
    Writing Your Failing Test                      74 (1)
    Making Your Test Pass                          75 (1)
    Driving More Features with Tests               75 (2)
    Wrapping Up the Task                           77 (5)
  Summary                                          82 (1)
  Resources                                        83 (2)
Chapter 6 Writing Acceptance Tests                 85 (22)
  What Is Acceptance Testing?                      85 (5)
    Anatomy of an Acceptance Test                  87 (1)
    Using Gherkin Syntax                           87 (1)
    The Magic Is in the Step File                  88 (1)
    Goals of Acceptance Testing                    89 (1)
    Implementing Developer and QA Collaboration    90 (1)
  Letting Behavior Drive Your Problem              90 (12)
    Writing Your Failing Acceptance Test           90 (2)
    Defining Your Steps                            92 (2)
    Implementing Your Code                         94 (1)
    Developing More of the Feature                 95 (3)
      bank_app.py                                  96 (1)
      index.html                                   97 (1)
    Delivering the Finished Article                98 (4)
  Advanced Acceptance Test Techniques              102(2)
    Scenario Outline                               102(1)
    Tables of Data in Scenarios                    103(1)
  Summary                                          104(1)
  Resources                                        105(2)
Chapter 7 Utilizing Acceptance Test Tools          107(18)
  Cucumber: The Acceptance Test Standard           107(1)
  Lettuce in Detail                                108(7)
    Tagging                                        108(4)
    Fail Fast                                      112(2)
    Nosetest Integration                           114(1)
  Robot: An Alternative Test Framework             115(8)
    Installing Robot                               116(1)
    Writing a Test Case                            116(1)
    Implementing Keywords                          117(2)
    Running Robot Tests                            119(4)
  Summary                                          123(1)
  Resources                                        123(2)
Chapter 8 Maximizing Your Code's Performance       125(20)
  Understanding the Importance of Performance      126(1)
  Testing
  JMeter and Python                                126(9)
    Installation                                   127(1)
    Configuring Your Test Plans                    128(7)
    Utilizing Your Test Plans Effectively          135(1)
  Code Profiling with cProfile                     135(9)
    Run a cProfile Session                         136(6)
    Analyzing the cProfile Output                  142(2)
  Summary                                          144(1)
  Resources                                        144(1)
Chapter 9 Looking After Your Lint                  145(18)
  Coming to Grips with Pylint                      146(8)
    Installing Pylint                              146(1)
    Using Pylint                                   146(4)
      Understanding the Pylint Report              149(1)
      The Module Block                             149(1)
      The Messages by Category Section             149(1)
      The Messages Section                         150(1)
      The Code Evaluation Score                    150(1)
      The Raw Metrics Section                      150(1)
      The Statistics by Type Section               150(1)
    Customizing Pylint's Output                    150(4)
      Telling Pylint to Ignore Errors              153(1)
  Covering All Your Code with Unit Tests           154(7)
    Installing Coverage                            155(1)
    Using Coverage                                 155(2)
    Advanced Coverage Options                      157(7)
      Producing an HTML/XML Report                 157(2)
      Setting a Minimum Coverage Threshold         159(1)
      Restricting Coverage to a Specific Package   159(1)
      Ignoring Coverage                            160(1)
  Summary                                          161(1)
  Resources                                        162(1)
Chapter 10 Automating Your Processes               163(20)
  Build Paver Tasks                                164(4)
    Installing Paver                               164(1)
    Creating a Paver Task                          164(1)
    Executing Paver Tasks                          165(1)
    Defining a Default Build                       166(2)
  Setting Up Automated Builds                      168(13)
    Installing Jenkins                             169(6)
    Adding Coverage and PyLint Reports             175(1)
      Generating a PyLint Report                   175(1)
      Generating a Coverage Report                 176(1)
    Making Your Build Status Highly Visible        176(5)
  Summary                                          181(1)
  Resources                                        181(2)
Chapter 11 Deploying Your Application              183(20)
  Deploying Your Application to Production         184(11)
    Creating a Deployable Artifact                 185(4)
      Defining the Paver Tasks                     185(2)
      Incorporating Packaging into the Build       187(1)
      Enabling Archiving on Jenkins                188(1)
    QA Environment                                 189(1)
    Implementing Stage and Production              190(1)
    Environments
    Implementing a Cloud Deployment                191(4)
      Creating a Heroku Account                    192(1)
      Creating a Small Application                 193(1)
      Setting up Git for Heroku                    193(1)
      Deploying the Application to Heroku          194(1)
  Smoke Testing a Deployed Application             195(5)
    Example Application Stack                      196(1)
    Smoke Test Scenarios                           197(1)
    Implementing Smoke Tests                       198(2)
  Summary                                          200(1)
  Resources                                        201(2)
Chapter 12 The Future of Testing Python            203(8)
  Stub the Solution                                203(2)
  Making Deployment Natural                        205(1)
  Automating (Nearly) Everything                   206(1)
  Working in Public                                207(1)
  Collaborating on Step Definitions                208(1)
  Final Thoughts                                   209(1)
  Resources                                        210(1)
Index                                              211

关闭


版权所有:西安交通大学图书馆      设计与制作:西安交通大学数据与信息中心  
地址:陕西省西安市碑林区咸宁西路28号     邮编710049

推荐使用IE9以上浏览器、谷歌、搜狗、360浏览器;推荐分辨率1360*768以上