
۴۴٬۰۰۰تومان
نوع فایل دانلود: PDF
پس از خرید، یک فایل PDF دریافت میکنید.
این فایل با Adobe Reader، مرورگر و اپهای PDF روی کامپیوتر و موبایل باز میشود.
این باور را کنار بگذارید که جاوااسکریپت بهراحتی قابل تست نیست. چه از Node.js، Express، MongoDB، jQuery یا AngularJS استفاده کنید، چه مستقیم با DOM کار کنید، میتوانید جاوااسکریپت را بهصورت تستمحور بنویسید. هنر نوشتن تستهای خودکار معنادار و قطعی را با Karma، Mocha و Chai یاد بگیرید. جاوااسکریپت ناهمگام را تست کنید، وابستگیها را جدا کنید و درست ماک کنید، پوشش کد را بسنجید و طراحیهای ماژولار و سبک برای کد سمت سرور و سمت کلاینت بسازید. سرمایهگذاریتان روی نوشتن تستها بازدهی بالایی دارد؛ چون کدی میسازید که رفتارش قابل پیشبینی است و تغییر دادنش مقرونبهصرفه است.
برنامههای جاوااسکریپت را با تستهای خودکار طراحی و پیادهسازی کنید. نوشتن تستهای معنادار مهارتی است که یادگیری، کمی ترک عادتهای قبلی و تمرین زیاد میخواهد؛ و با این کتاب این مهارت را پرورش میدهید. ویرایشگر را باز کنید و با تمرینهای عملی، تست خودکار مؤثر و طراحی کد قابلنگهداری و ماژولار را تجربه کنید.
ابتدا یاد بگیرید چه وقت و چرا باید تست دستی انجام دهید و چه وقت از بررسی خودکار استفاده کنید. تستها را روی چیزهای مهم متمرکز کنید؛ مثل پیششرطها، ناورداها، منطق پیچیده و موارد لبهای سخت. سپس طراحی توابع ناهمگام را با کمک تستهای خودکار شروع کنید. وابستگیهای پیچیده مثل DOM، API موقعیتیابی، دسترسی به فایل و پایگاه داده، و فراخوانیهای Ajax به سرورهای راه دور را با دقت جدا و ماک کنید.
گامبهگام، کدی را که از Node.js، Express، MongoDB، jQuery و AngularJS استفاده میکند تست کنید. بدانید چه وقت و چگونه از ابزارهایی مثل Chai، Istanbul، Karma، Mocha، Protractor و Sinon استفاده کنید. تستها را با کمترین زحمت بنویسید و سریع اجرا کنید؛ بدون اینکه لازم باشد سرور وب راه بیندازید یا صفحات HTML را دستی ویرایش کنید تا در مرورگر اجرا شوند. سپس تست انتهابهانتها را بررسی کنید تا مطمئن شوید همه بخشها درست به هم وصل شدهاند و خوب با هم کار میکنند.
فقط تصور نکنید که کد قابل تست مینویسید؛ واقعاً بنویسیدش.
آنچه نیاز دارید:
یک رایانه با ویرایشگر متن و مرورگر موردعلاقهتان. کتاب راهنمای نصب ابزارهای لازم برای تست خودکار را ارائه میدهد.
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.