وبلاگ بلیان

Test-Driving JavaScript Applications : Rapid, Confident, Maintainable Code

معرفی کتاب «Test-Driving JavaScript Applications : Rapid, Confident, Maintainable Code» نوشتهٔ Venkat Subramaniam، منتشرشده توسط نشر Pragmatic Bookshelf در سال 2016. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Test-Driving JavaScript Applications : Rapid, Confident, Maintainable Code» در دستهٔ بدون دسته‌بندی قرار دارد.

Debunk the myth that JavaScript is not easily testable. Whether you use Node.js, Express, MongoDB, jQuery, AngularJS, or directly manipulate the DOM, you can test-drive JavaScript. Learn the craft of writing meaningful, deterministic automated tests with Karma, Mocha, and Chai. Test asynchronous JavaScript, decouple and properly mock out dependencies, measure code coverage, and create lightweight modular designs of both server-side and client-side code. Your investment in writing tests will pay high dividends as you create code that's predictable and cost-effective to change. Design and code JavaScript applications with automated tests. Writing meaningful tests is a skill that takes learning, some unlearning, and a lot of practice, and with this book, you'll hone that skill. Fire up the editor and get hands-on through practical exercises for effective automated testing and designing maintainable, modular code. Start by learning when and why to do manual testing vs. automated verification. Focus tests on the important things, like the pre-conditions, the invariants, complex logic, and gnarly edge cases. Then begin to design asynchronous functions using automated tests. Carefully decouple and mock out intricate dependencies such as the DOM, geolocation API, file and database access, and Ajax calls to remote servers. Step by step, test code that uses Node.js, Express, MongoDB, jQuery, and AngularJS. Know when and how to use tools such as Chai, Istanbul, Karma, Mocha, Protractor, and Sinon. Create tests with minimum effort and run them fast without having to spin up web servers or manually edit HTML pages to run in browsers. Then explore end-to-end testing to ensure all parts are wired and working well together. Don't just imagine creating testable code, write it. What You Need: A computer with a text editor and your favorite browser. The book provides instructions to install the necessary automated testing-related tools Cover 1 Table of Contents 9 Acknowledgments 13 Introduction 15 What’s in This Book? 16 Who Is This Book For? 18 Online Resources 18 Your Own Workspace 19 1. Automation Shall Set You Free 20 The Challenges of Change 20 Testing vs. Verification 21 Adopting Automated Verification 22 Why Is It Hard to Verify? 25 How to Approach Automated Testing 26 Wrapping Up 27 Part I—Creating Automated Tests 28 2. Test-Drive Your Design 29 Let’s Get Started 30 Design with Positive, Negative, and Exception Tests 39 Design Server-Side Code 41 Measure Server-Side Code Coverage 51 Prepare for Client-Side Testing 54 Design Client-Side Code 58 Measure Client-Side Code Coverage 61 Wrapping Up 62 3. Test Asynchrony 63 Server-Side Callbacks 64 Client-Side Callbacks 69 Test Your Promises 72 Wrapping Up 78 4. Tactfully Tackle Dependencies 79 A Problem and Spiking to Learn 79 Visualize a Modular Design 82 Separate Dependencies Where Possible 83 Employ Test Doubles 86 Inject the Dependencies 89 Test Interactions 90 Use Sinon to Reduce Noise 93 Review and Run 102 Wrapping Up 106 Part II—Real-World Automated Testing 107 5. Test-Drive Node.js Apps 108 Start with a Strategic—Just Enough—Design 108 Leap Into Tactical—Test First—Design 110 Continue the Design 116 Create a Spike to Gain Insight 119 Modularize to Facilitate Testing 125 Separate Concerns 129 Integrate and Run 131 Review the Coverage and Design 134 Providing HTTP Access 136 Wrapping Up 137 6. Test-Drive Express Apps 138 Design for Testability 138 Set Up the Express App and Run a Canary Test 141 Design the Database Connection 142 Design the Model 146 Design the Routes 161 Measure Code Coverage 171 Take It for a Drive 173 Wrapping Up 177 7. Working with the DOM and jQuery 178 Create a Strategic Design 178 Create the Tactical Design with Tests 179 Evolve Code in Small Steps 181 Take the UI for a Short Drive 192 Complete the Design 193 Test with jQuery 203 Measure Code Coverage 208 Wrapping Up 210 8. Using AngularJS 211 Testing the AngularJS Way 211 Start with an Initial Design 214 Focus on the Controller 216 Design Service Interaction 220 Separate Concerns, Reduce Mocking 223 Continue the Design 229 Design the Service 235 Measure Code Coverage 241 Take the UI for a Drive 242 Wrapping Up 243 9. Test-Drive Angular 2 245 Spike to Learn Angular 246 Design Angular Apps with Tests 259 Test-Drive the Component 261 Test-Drive the Service 274 Test-Drive the Pipe 279 Test-Drive the BootStrap Code 283 Take It for a Ride 284 Complete the Design 287 Wrapping Up 299 10. Integrate and Test End-to-End 300 Get to Know Protractor 301 Start the Server and Configure the Database 308 Test jQuery UI 313 Let’s Use a Page Object 318 Test AngularJS UI 322 Test Angular 2 UI 326 Wrapping Up 329 11. Test-Drive Your Apps 330 The Fruits of Our Efforts 330 Size and Levels of Testing 334 Test Driving: The Programmer’s Guide 336 Test Driving: The Team Lead’s/Architect’s Guide 338 Test Driving: The Manager’s Guide 339 Rock On! 343 A1. Web Resources 344 Bibliography 347 Index 348 – SYMBOLS – 348 – A – 348 – B – 348 – C – 348 – D – 349 – E – 349 – F – 349 – G – 350 – H – 350 – I – 350 – J – 350 – K – 350 – L – 350 – M – 350 – N – 350 – O – 350 – P – 350 – Q – 351 – R – 351 – S – 351 – T – 351 – U – 352 – V – 352 – W – 352 Your customers want rock-solid, bug-free software that does exactly what they expect it to do. Yet they can't always articulate their ideas clearly enough for you to turn them into code. The Cucumber Book dives straight into the core of the problem: communication between people. Cucumber saves the day; it's a testing, communication, and requirements tool - all rolled into one. We'll show you how to express your customers' wild ideas as a set of clear, executable specifications that everyone on the team can read. You'll learn how to feed those examples into Cucumber and let it guide your development. You'll build just the right code to keep your customers happy, and not a line more. The first part of the book teaches you how to use the core features of Cucumber. You'll learn how to use Cucumber's Gherkin DSL to describe-- in plain language - the behavior your customers want from the system. You'll learn how to write Ruby code that interprets those plain language specifications and checks them against your application. In Part 2, you'll consolidate the knowledge you just gained with a worked example. Although it was born in the Ruby community, you can use Cucumber to test almost any system, from a simple shell script or a Perl script, to enterprise PHP or a Java web application. In Part 3, you'll find a selection of recipes for some of the most common situations you'll encounter using Cucumber in the wild. You'll learn how to test Ajax-heavy web applications with Capybara and Selenium, REST web services, Ruby on Rails applications, command-line applications, legacy applications and lots more! Written by the creator of Cucumber and one of its most experienced users and contributors, The Cucumber Book is an authoritative guide that will give you and your team all the knowledge you need to start using Cucumber with confidence. What You Need: Windows, Mac OS X (with XCode) or Linux Ruby 1.9.2 and upwards Annotation With the advent of HTML5, front-end MVC, and Node.js, JavaScript is ubiquitous--and still messy. This book will give you a solid foundation for managing async tasks without losing your sanity in a tangle of callbacks. It's a fast-paced guide to the most essential techniques for dealing with async behavior, including PubSub, evented models, and Promises. With these tricks up your sleeve, you'll be better prepared to manage the complexity of large web apps and deliver responsive code. With Async JavaScript, you'll develop a deeper understanding of the JavaScript language. You'll start with a ground-up primer on the JavaScript event model--key to avoiding many of the most common mistakes JavaScripters make. From there you'll see tools and design patterns for turning that conceptual understanding into practical code. The concepts in the book are illustrated with runnable examples drawn from both the browser and the Node.js server framework, incorporating complementary libraries including jQuery, Backbone.js, and Async.js. You'll learn how to create dynamic web pages and highly concurrent servers by mastering the art of distributing events to where they need to be handled, rather than nesting callbacks within callbacks within callbacks. Async JavaScript will get you up and running with real web development quickly. By the time you've finished the Promises chapter, you'll be parallelizing Ajax requests or running animations in sequence. By the end of the book, you'll even know how to leverage Web Workers and AMD for JavaScript applications with cutting-edge performance. Most importantly, you'll have the knowledge you need to write async code with confidence. What You Need:Basic knowledge of JavaScript is recommended. If you feel that you're not up to speed, see the "Resources for Learning JavaScript" section in the preface Uncover surprises, risks, and potentially serious bugs with exploratory testing. Rather than designing all tests in advance, explorers design and execute small, rapid experiments, using what they learned from the last little experiment to inform the next. Learn essential skills of a master explorer, including how to analyze software to discover key points of vulnerability, how to design experiments on the fly, how to hone your observation skills, and how to focus your efforts.Software is full of surprises. No matter how careful or skilled you are, when you create software it can behave differently than you intended. Exploratory testing mitigates those risks. Part 1 introduces the core, essential skills of a master explorer. You'll learn to craft charters to guide your exploration, to observe what's really happening (hint: it's harder than it sounds), to identify interesting variations, and to determine what expected behavior should be when exercising software in unexpected ways. Part 2 builds on that foundation. You'll learn how to explore by varying interactions, sequences, data, timing, and configurations. Along the way you'll see how to incorporate analysis techniques like state modeling, data modeling, and defining context diagrams into your explorer's arsenal. Part 3 brings the techniques back into the context of a software project. You'll apply the skills and techniques in a variety of contexts and integrate exploration into the development cycle from the very beginning.You can apply the techniques in this book to any kind of software. Whether you work on embedded systems, Web applications, desktop applications, APIs, or something else, you'll find this book contains a wealth of concrete and practical advice about exploring your software to discover its capabilities, limitations, and risks. Uncover surprises, risks, and potentially serious bugs with exploratory testing. Rather than designing all tests in advance, explorers design and execute small, rapid experiments. In this book, you'll learn how to analyze software to discover key points of vulnerability, how to design experiments on the fly, how to hone your observation skills, and how to focus your efforts. You'll start by crafting charters to guide your exploration. Then you'll vary interactions, sequences, data, timing, and configurations. You'll incorporate analysis techniques such as state modeling, data modeling, and defining context diagrams. Finally, you'll apply the skills and techniques in a variety of contexts and integrate exploration into the development cycle from the beginning. You can apply the techniques in this book to any kind of software to discover its capabilities, limitations, and risks.

Debunk the myth that JavaScript is not easily testable. Whether you use Node.js, Express, MongoDB, jQuery, AngularJS, or directly manipulate the DOM, you can test-drive JavaScript. Learn the craft of writing meaningful, deterministic automated tests with Karma, Mocha, and Chai. Test asynchronous JavaScript, decouple and properly mock out dependencies, measure code coverage, and create lightweight modular designs of both server-side and client-side code. Your investment in writing tests will pay high dividends as you create code that's predictable and cost-effective to change.

With the advent of HTML5, front-end MVC, and Node.js, JavaScript is ubiquitous--and still messy. This book will give you a solid foundation for managing async tasks without losing your sanity in a tangle of callbacks. It's a fast-paced guide to the most essential techniques for dealing with async behavior, including PubSub, evented models, and Promises. With these tricks up your sleeve, you'll be better prepared to manage the complexity of large web apps and deliver responsive code.

Uncover surprises, risks, and potentially serious bugs with exploratory testing. Rather than designing all tests in advance, explorers design and execute small, rapid experiments, using what they learned from the last little experiment to inform the next. Learn essential skills of a master explorer, including how to analyze software to discover key points of vulnerability, how to design experiments on the fly, how to hone your observation skills, and how to focus your efforts.

"Design and code JavaScript applications with automated tests. Fire up your editor and get hands-on through practical exercises and effective automated testing and designing maintainable, modular code"--Back cover
دانلود کتاب Test-Driving JavaScript Applications : Rapid, Confident, Maintainable Code