چه کسانی این کتاب را می‌خوانند

دانشجوعلاقه‌مند یادگیری
کتابخوان حرفه‌ایلذت مطالعه
نویسندهالهام‌گیری

Python testing : beginner's guide : an easy and convenient approach to testing your Python projects

Daniel Arbuckle

قیمت نهایی

۴۰٬۰۰۰ تومان۴۹٬۰۰۰ تومان۱۸٪ تخفیف
  • تخفیف زمان‌دار−۹٬۰۰۰ تومان

۹٬۰۰۰ تومان صرفه‌جویی نسبت به قیمت اصلی

نسخه اصلی و اورجینال

بلافاصله پس از خرید، فایل کتاب روی دستگاه شما آمادهٔ دانلود است.

تحویل فوری
پرداخت امن
ضمانت فایل
پشتیبانی

مشخصات کتاب

نویسنده
Daniel Arbuckle
سال انتشار
۲۰۱۰
فرمت
PDF
زبان
انگلیسی
تعداد صفحات
۵ صفحه
حجم فایل
۴٫۸ مگابایت
شابک
9781282501829، 9781847198846، 9781847198853، 9786612501821، 1282501828، 1847198848، 1847198856، 6612501820

دربارهٔ کتاب

I've recently had the pleasure of reading "Python Testing: An easy and convenient approach to testing your python projects" from Packt Publishing. It's been a quick read but a solid set of instructions on the different methods for the subject. The book starts out very quickly with details about the various methods that are available, the means of automation for testing, and of course the environment you'd want to be in for working on the subjects that the book covers. It then, in the second chapter, moves into the guts of testing by describing the basics of doctest via syntax and some simple examples, and then moves on to a real world example via the AVL tree. It's all very basic testing until chapter three where the author gets into unit testing, which is probably the most useful method in my opinion, and he goes to prove it's usefulness with examples of it's use in different parts and stages of the development process. Later in the book the python mocker is used to separate unit sections, and then the actual unittest framework is discussed with more examples and a enough details that if you don't understand it by then, you may never. By chapter six we are into the Nose app that drives the unittest, which is very useful of course. The most useful part of the book comes toward the end where the author discusses and the walks through the method used to create a test-driven application and then even shows examples via the whole chapter dedicated towards making a testable web application frontend. Very impressive for such a quick read. Integration testing and System testing is also covered, thankfully. The final chapter covers some useful tools and techniques of which I particularly enjoyed the section on version control hooks. If you are not using version control in your development process you need to start now, as such the hooks for integration with the test framework are rather useful to know. Overall this is a very nice book that discusses python application testing from the ground up. It's perfect for a beginner or an intermediate python programmer that has little to no experience in automated testing methods. More advanced programmers that have already used these methods will probably not find the book too useful except for the last chapter that covers extra tools and techniques that they might not have seen before. If I didn't have this book and needed to learn about python testing, it would be my first choice and my only recommendation so far. Well written and very useful. If there is one thing I do not like about the book, it would be the reliance on the python CLI for running commands. I am a CLI kind of person and I keep lots of terminals open at the same time, so I prefer to write my code in an editor or IDE in one term tab, then switch to another and execute the script; I do not use the python command line to do much of anything. So following some of the steps in the book require that you follow the CLI method and that gets old for me. It's a personal preference but one worth noting as there is a lot of it in the book. That's the only thing I did not enjoy in a book that was otherwise basically perfect for the subject. Cover 1 Copyright 2 Credits 3 About the Author 4 About the Reviewers 5 Table of Contents 7 Preface 15 Chapter 1: Testing for Fun and Profit 21 How can testing help? 22 Types of testing 23 Unit testing 23 Integration testing 23 System testing 23 You've got Python, right? 24 Summary 24 Chapter 2: Doctest: The Easiest Testing Tool 25 Basic doctest 25 Time for action – creating and running your first doctest 26 The syntax of doctests 27 Time for action – writing a more complex test 28 Expecting exceptions 29 Time for action – expecting an exception 30 Expecting blank lines in the output 31 Using directives to control doctest 31 Ignoring part of the result 31 Time for action – using ellipsis in tests 31 Ignoring whitespace 32 Time for action – normalizing whitespace 33 Skipping an example entirely 33 Time for action – skipping tests 34 Other doctest directives 35 Execution scope 35 Embedding doctests in Python docstrings 38 Time for action – embedding a doctest in a docstring 38 Doctest directives 39 Execution scope 40 Putting it in practice: an AVL tree 40 English specification 41 Node data 42 Constructor 44 Recalculate height 44 Make deletable 46 Rotation 47 Locating a node 48 Testing the rest of the specification 48 Summary 49 Chapter 3: Unit Testing with Doctest 51 What is Unit testing and what it is not? 51 Time for action – identifying units 52 Unit testing throughout the development process 54 Design phase 55 Time for action – unit testing during design 55 Development phase 58 Time for action – unit testing during development 58 Feedback phase 61 Time for action – unit testing during feedback 61 Back to the development phase 65 Time for action – unit testing during development... again 65 Maintenance phase 67 Time for action – unit testing during maintenance 67 Reuse phase 69 Time for action – unit testing during reuse 69 Summary 73 Chapter 4: Breaking Tight Coupling by using Mock Objects 75 Installing Python Mocker 75 Time for action – installing Python Mocker 76 The idea of a mock object 76 Python Mocker 77 Time for action – exploring the basics of Mocker 77 Mocking functions 81 Mocking containers 82 Parameter matching 83 ANY 83 ARGS 84 KWARGS 84 IS 85 IN 85 CONTAINS 86 MATCH 86 Mocking complex expressions 87 Returning iterators 87 Raising exceptions 88 Calling functions via a mock 88 Specifying that an expectation should occur multiple times 89 Replacing library objects with mocks 91 Mocking self 94 Time for action – passing a mock object as self 94 Summary 96 Chapter 5: When Doctest isn't Enough: Unittest to the Rescue 97 Basic unittest 97 Time for action – testing PID with unittest 98 Assertions 103 assertTrue 103 assertFalse 104 assertEqual 104 assertNotEqual 104 assertAlmostEqual 104 assertNotAlmostEqual 106 assertRaises 106 fail 107 Test fixtures 108 Time for action – testing database-backed units 109 Integrating with Python Mocker 114 Summary 114 Chapter 6: Running Your Tests: Follow Your Nose 115 What is Nose? 115 Installing Nose 116 Organizing tests 117 Time for action – organizing tests from previous chapters 118 Finding doctests 122 Customizing Nose's search 123 Nose and doctest 124 Time for action – creating a fixture for a doctest 125 Nose and unittest 126 Time for action – creating a module fixture 127 Time for action – creating a package fixture 128 Nose's own testing framework 130 Time for action – using Nose-specific tests 130 Summary 132 Chapter 7: Developing a Test-Driven Project 133 Writing the specification 133 Time for action – what are you going to do? 139 Writing initial unit tests 139 Time for action – nailing down the specification with unit tests 153 Coding planner.data 153 Using the tests to get the code right 157 Fixing the code 157 Time for action – writing and debugging code 160 Writing persistence tests 161 Writing persistence code 162 Finishing up 165 Summary 167 Chapter 8: Testing Web Application Frontends using Twill 169 Installing Twill 169 Exploring the Twill language 170 Time for action – browsing the web with Twill 170 Time for action – Twill scripting 173 Twill commands 174 help 174 setglobal 174 setlocal 175 add_auth 175 add_extra_header 175 clear_extra_headers 176 show_extra_headers 176 agent 176 back 176 clear_cookies 176 code 176 config 177 debug 177 echo 177 exit 177 extend_with 178 find 178 notfind 178 follow 178 formaction 178 formclear 179 formfile 179 formvalue 179 getinput 179 getpassword 179 go 180 info 180 save_cookies 180 load_cookies 180 show_cookies 180 redirect_error 180 redirect_output 180 reset_error 180 reset_output 181 reload 181 reset_browser 181 run 181 runfile 181 save_html 181 show 181 showforms 181 showhistory 182 showlinks 182 sleep 182 submit 182 tidy_ok 182 title 182 url 182 Calling Twill scripts from tests 183 Time for action – running Twill script files 183 Time for action – running Twill script strings 184 A nifty trick 185 Integrating Twill operations into unittest tests 186 Time for action – using Twill's browser object 186 Browser methods 187 get_code 188 get_html 188 get_title 188 get_url 188 find_link 188 follow_link 189 get_all_forms 189 get_form 189 get_form_field 189 clicked 190 submit 190 Summary 190 Chapter 9: Integration Testing and System Testing 191 Integration tests and system tests 191 Time for action – figuring out the order of integration 192 Automation with doctest, unittest, and Nose 194 Time for action – writing integration tests for the time planner 195 Summary 216 Chapter 10: Other Testing Tools and Techniques 217 Code coverage 217 coverage.py 218 Time for action – using coverage.py 219 Version control hooks 221 Bazaar 222 Time for action – installing Nose as a Bazaar post-commit hook 222 Mercurial 224 Time for action – installing Nose as a Mercurial 224 post-commit hook 224 Git 225 Time for action – installing Nose as a Git post-commit hook 226 Darcs 227 Time for action – installing Nose as a Darcs post-record hook 227 Subversion 229 Time for action – installing Nose as a Subversion 230 post-commit hook 230 Automated continuous integration 233 Buildbot 233 Time for action – using Buildbot with Bazaar 233 Summary 237 Appendix: Answers to Pop Quizes 239 Chapter 2 239 Pop quiz – doctest syntax 239 Chapter 3 239 Pop quiz – understanding units 239 Pop quiz – unit testing during design 240 Pop quiz – unit testing 240 Chapter 4 240 Pop quiz – Mocker usage 240 Chapter 5 241 Pop quiz – basic unittest knowledge 241 Pop quiz – text fixtures 241 Chapter 6 241 Pop quiz – testing with Nose 241 Chapter 7 241 Pop quiz – test-driven development 241 Chapter 8 242 Pop quiz – the Twill language 242 Pop quiz – browser methods 242 Chapter 9 242 Pop quiz – diagramming integration 242 Pop quiz – writing integration tests 243 Chapter 10 243 Pop quiz – code coverage 243 Pop quiz – version control hooks 243 Index 245 Annotation Automated testing moves much of the labor of testing off the developer and makes it easier as well as quicker to find bugs and fix them. Automated tests run faster, increase test coverage, and lower costs. However, testing is neither an easy process nor remotely exciting for most developers. But with the right techniques and tools, testing can become a simple and gratifying part of the development process. With this helpful guide _ from an expert _ in your hand, testing will not be a tiresome topic for you anymore. You will learn how to test your Python projects in the easiest way, making other parts of the development process easier and more enjoyable. This book covers the tools and techniques of automated testing and test-driven development. Starting from the very basics, the chapters introduce new tools and techniques in simple, accessible language with step-by-step examples. You will explore how to make testing easier and more accurate with Python's doctest module and learn test-driven development using the unittest framework. You will also learn how to keep your units separate from each other and discover a simple and easy way to integrate Mocker and unittest. Next, we cover integration testing and web application testing. Automated testing gives developers better feedback, faster and more often. Bugs get found sooner and fixed better, with less effort. By the end of this book, you will have all of the skills needed to benefit from automated testing The book begins with the very foundations of automated testing, and expands on them until the best-practice tools and techniques are fully covered. New concepts are illustrated with step-by-step hands-on exercises. Testing will be easier and more enjoyable with this beginner's guide. If you are a Python developer and want to write tests for your applications, this book will get you started and show you the easiest way to learn testing. You need to have sound Python programming knowledge to follow along. An awareness of software testing would be good, but no formal knowledge of testing is expected nor do you need to have any knowledge of the libraries discussed in the book.

کتاب‌های مشابه

Python testing : beginner's guide : an easy and convenient approach to testing your Python projects

Python testing : beginner's guide : an easy and convenient approach to testing your Python projects

۴۹٬۰۰۰ تومان

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

۴۹٬۰۰۰ تومان

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

۴۹٬۰۰۰ تومان

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

Python Testing : An easy and convenient approach to testing your powerful Python projects: Beginner's Guide

۴۹٬۰۰۰ تومان

Learning Python testing : a straightforward and easy approach to testing your Python projects

Learning Python testing : a straightforward and easy approach to testing your Python projects

۴۹٬۰۰۰ تومان

Learning Python testing : a straightforward and easy approach to testing your Python projects

Learning Python testing : a straightforward and easy approach to testing your Python projects

۴۹٬۰۰۰ تومان

Learning Python testing : a straightforward and easy approach to testing your Python projects

Learning Python testing : a straightforward and easy approach to testing your Python projects

۴۹٬۰۰۰ تومان

Learning Python testing : a straightforward and easy approach to testing your Python projects

Learning Python testing : a straightforward and easy approach to testing your Python projects

۴۹٬۰۰۰ تومان

Learning Python testing : a straightforward and easy approach to testing your Python projects

Learning Python testing : a straightforward and easy approach to testing your Python projects

۴۹٬۰۰۰ تومان

Python for Beginners: A Step-by-Step Guide to Master the Basics of Python with Easy Projects

Python for Beginners: A Step-by-Step Guide to Master the Basics of Python with Easy Projects

۴۹٬۰۰۰ تومان

Python Testing Cookbook.: Easy solutions to test your Python projects using test-driven development and Selenium, 2nd Edition

Python Testing Cookbook.: Easy solutions to test your Python projects using test-driven development and Selenium, 2nd Edition

۴۹٬۰۰۰ تومان

Python Testing Cookbook.: Easy solutions to test your Python projects using test-driven development and Selenium, 2nd Edition

Python Testing Cookbook.: Easy solutions to test your Python projects using test-driven development and Selenium, 2nd Edition

۴۹٬۰۰۰ تومان

قیمت نهایی

۴۰٬۰۰۰ تومان