Testable JavaScript

0
(0)
Testable JavaScript  
  • Author:Mark Ethan Trostler
  • Length: 274 pages
  • Edition: 1
  • Publisher: O’Reilly Media
  • Publication Date: 2013-01-31
  • ISBN-10: 1449323391
  • ISBN-13: 9781449323394
  • Sales Rank: #914813 (See Top 100 Books)
  • Download:Register/Login to Download
  • Buy Print:Buy from amazon

    Book Description

    One skill that’s essential for any professional JavaScript developer is the ability to write testable code. This book shows you what writing and maintaining testable JavaScript for the client- or server-side actually entails, whether you’re creating a new application or rewriting legacy code.

    From methods to reduce code complexity to unit testing, code coverage, debugging, and automation, you’ll learn a holistic approach for writing JavaScript code that you and your colleagues can easily fix and maintain going forward. Testing JavaScript code is complicated. This book helps you simply the process considerably.

    • Get an overview of Agile, test-driven development, and behavior-driven development
    • Use patterns from static languages and standards-based JavaScript to reduce code complexity
    • Learn the advantages of event-based architectures, including modularity, loose coupling, and reusability
    • Explore tools for writing and running unit tests at the functional and application level
    • Generate code coverage to measure the scope and effectiveness of your tests
    • Conduct integration, performance, and load testing, using Selenium or CasperJS
    • Use tools for in-browser, Node.js, mobile, and production debugging
    • Understand what, when, and how to automate your development processes

    Q&A with Mark Ethan Trostler, author of “Testable JavaScript”

    Testable JavaScript

    Q. Why is your book timely– what makes it important right now?

    A. The rise of mobile is well documented. The only thing that all of these mobile devices have in common, not only with themselves but also their bigger desktop brethren, is a browser. The only language available in all of those environments is JavaScript. Now, with the rise of server-side JavaScript, it may well be the only language that developers need for their increasingly complex applications.

    From the deepest darkest recesses of the server to the bright light of day on a mobile device, laptop, or desktop– JavaScript is ubiquitous. Yet JavaScript is also a relative newcomer, especially on the server side. The toolchain-available ability to write, test, and deploy enterprise-scale (or any-scale) JavaScript-based applications is still in its infancy. In this fast-moving, constantly changing landscape it is more important than ever to understand the best practices surrounding how to structure, code, test, and deploy your JavaScript applications.

    “Testable JavaScript” is at the forefront of this movement demonstrating how to craft, test, and deploy testable and maintainable JavaScript running on the complete stack from server to client (and back).

    Q. What information do you hope that readers of your book will walk away with?

    A. Readers will recognize that the lessons they have learned from previous experiences with other language translate well to JavaScript– albeit with several twists and turns.

    <p<>After gaining a better appreciation for the myriad of environments within which JavaScript must run, and then having wrapped their heads around code complexity as it relates to JavaScript specifically, readers will see concrete examples of how their JavaScript can get into trouble, followed by tips and honest advice how to extricate their code from those pitfalls.

    Readers will see not only how to write code that is testable but also how exactly to test it– from unit tests to integration tests to performance testing and beyond. Readers will get a first-hand look at how to generate code coverage for all of their JavaScript tests, both at the unit and integration test levels.

    Finally, readers will learn how to make all of the above automatic in several different environments, whether running tests on the command line, in a headless browser, or in a real

    Q. What’s the most exciting/important thing happening in your space?

    A. The rise of server-side JavaScript via NodeJS and Rhino is the most exciting development in the JavaScript world. Allowing developers to code their entire app in a single language is a giant boon for productivity. JavaScript is a “hot” language right now, not only is there tons of work being done on the server-side– the number of open source third-party modules is growing exponentially– but client-side JavaScript frameworks are also proliferating like weeds. There are a huge number of “framework” libraries available that are very actively being developed, not to mention that the language itself is also under heavy development.

    Finally, browser vendors are far from standing still; there are a huge number of newly standardized and almost-standardized features being rolled out constantly in all major browsers for JavaScript developers to start taking advantage of.

    There has never been a better time to be a JavaScript developer.

    中文:

    书名:可测试的JavaScript

    对于任何专业的JavaScript开发人员来说,一项必不可少的技能是编写可测试代码的能力。这本书向您展示了为客户端或服务器端编写和维护可测试的JavaScript实际上需要做些什么,无论您是在创建新应用程序还是重写遗留代码。

    从降低代码复杂性的方法到单元测试、代码覆盖、调试和自动化,您将学习一种编写您和您的同事可以轻松修复和维护的Java代码的整体方法。测试JavaScript代码很复杂。这本书在很大程度上帮助你简化了这个过程。

    • Get an overview of Agile, test-driven development, and behavior-driven development
    • 使用静态语言中的模式和基于标准的Java脚本来降低代码复杂性
    • 了解基于事件的体系结构的优势,包括模块化、松散耦合和可重用性
    • 探索用于在功能和应用程序级别编写和运行单元测试的工具
    • 生成代码覆盖率以衡量测试的范围和有效性
    • 使用Selify或CasperJS进行集成、性能和负载测试
    • 使用工具进行浏览器内、Node.js、移动设备和生产调试
    • Understand what, when, and how to automate your development processes

    问与答:马克·伊桑·特罗斯特勒,《可测试的脚本》的作者

    Testable JavaScript

    问:为什么你的书很及时?是什么让它现在变得如此重要?

    答:移动设备的崛起是有据可查的。所有这些移动设备唯一的共同点是浏览器,这不仅是它们自己的共同点,也是它们更大的桌面设备的共同点。在所有这些环境中,唯一可用的语言是JavaScript。现在,随着服务器端JavaScript的兴起,它很可能是开发人员在其日益复杂的应用程序中唯一需要的语言。

    从服务器最黑暗的深处,到移动设备、笔记本电脑或台式机上的明亮光芒&#8211;JavaScript无处不在。然而,JavaScript也是一个相对较新的产品,尤其是在服务器端。工具链提供的编写、测试和部署基于企业级(或任何规模)的应用程序的能力仍处于初级阶段。在这个快速发展、不断变化的环境中,了解围绕如何构建、编码、测试和部署您的Java应用程序的最佳实践比以往任何时候都更加重要。

    可测试的JavaScript处于这一运动的前沿,展示了如何在从服务器到客户端(以及后端)的整个堆栈上构建、测试和部署运行在完整堆栈上的可测试和可维护的JavaScript。

    问:你希望你的书的读者带着什么信息离开?

    答:读者会意识到,他们从以前使用其他语言的经验中学到的东西很好地翻译成了JavaScript,尽管有几个曲折。

    在对必须在其中运行的无数环境有了更好的理解,并对代码复杂性有了更好的了解后,读者将看到他们的JavaScript如何陷入困境的具体例子,然后是如何将他们的代码从这些陷阱中解脱出来的提示和诚实的建议。

    读者不仅会看到如何编写可测试的代码,还会看到如何准确地测试它,从单元测试到集成测试,再到性能测试等等。读者将第一手了解如何在单元和集成测试级别为他们的所有JavaScript测试生成代码覆盖率。

    最后,读者将学习如何在几种不同的环境中自动执行上述所有操作,无论是在命令行上运行测试、在无头浏览器中还是在真实的

    问:在你的空间里发生的最令人兴奋/最重要的事情是什么?

    答:通过NodeJS和Rhino崛起的服务器端JavaScript是JavaScript世界中最令人兴奋的发展。允许开发人员用一种语言编写他们的整个应用程序,对生产率来说是一个巨大的福音。JavaScript现在是一门热门语言,不仅在服务器端完成了大量的工作,开放源代码的第三方模块的数量也在指数级增长,而且客户端JavaScript框架也像野草一样激增。有大量可用的框架库正在非常活跃地开发,更不用说语言本身也在大力开发中。

    最后,浏览器供应商远未停滞不前;所有主流浏览器中都不断推出大量新标准化和几乎标准化的特性,以供JavaScript开发人员开始利用。

    没有比现在更适合做一名JavaScript开发人员的时候了。

  • 下载电子版:下载地址
  • 购买纸质版:亚马逊商城

    点击星号评分!

    平均分 0 / 5. 投票数: 0

    还没有投票!请为他投一票。

  • 评论 抢沙发

    评论前必须登录!

     

    登录

    找回密码

    注册