Scala Test-Driven Development
eBook - ePub

Scala Test-Driven Development

Gaurav Sood

Share book
  1. 198 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Scala Test-Driven Development

Gaurav Sood

Book details
Book preview
Table of contents
Citations

About This Book

Build robust Scala applications by implementing the fundamentals of test-driven development in your workflow

About This Book

  • Get a deep understanding of various testing concepts such as test-driven development (TDD) and BDD
  • Efficient usage of the built-in Scala features such as ScalaTest, specs2, and Scala check
  • Change your approach towards problem solving by thinking about the boundaries of the problem and its definition rather than focusing on the solution

Who This Book Is For

This book is for Scala developers who are looking to write better quality and easily maintainable code. No previous knowledge of TDD/BDD is required.

What You Will Learn

  • Understand the basics of TDD and its significance
  • Refactoring tests to build APIs in order to increase test coverage
  • How to leverage the inbuilt Scala testing modules like ScalaTest, specs2 and Scala Check
  • Writing test fixtures and apply the concepts of BDD
  • How to divide tests to run at different points in continuous delivery cycle
  • Benefits of refactoring and how it affects the final quality of code produced
  • Understanding of SBT based build environment and how to use it to run tests
  • The fundamentals of mocking and stubbing in Scala and how to use it efficiently

In Detail

Test-driven development (TDD) produces high-quality applications in less time than is possible with traditional methods. Due to the systematic nature of TDD, the application is tested in individual units as well as cumulatively, right from the design stage, to ensure optimum performance and reduced debugging costs.

This step-by-step guide shows you how to use the principles of TDD and built-in Scala testing modules to write clean and fully tested Scala code and give your workflow the change it needs to let you create better applications than ever before.

After an introduction to TDD, you will learn the basics of ScalaTest, one of the most flexible and most popular testing tools around for Scala, by building your first fully test-driven application. Building on from that you will learn about the ScalaTest API and how to refactor code to produce high-quality applications.

We'll teach you the concepts of BDD (Behavior-driven development) and you'll see how to add functional tests to the existing suite of tests. You'll be introduced to the concepts of Mocks and Stubs and will learn to increase test coverage using properties.

With a concluding chapter on miscellaneous tools, this book will enable you to write better quality code that is easily maintainable and watch your apps change for the better.

Style and approach

This step-by-step guide explains the significance of TDD in Scala through various practical examples. You will learn to write a complete test-driven application throughout the course of the book.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Scala Test-Driven Development an online PDF/ePUB?
Yes, you can access Scala Test-Driven Development by Gaurav Sood in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781786464675

Scala Test-Driven Development


Scala Test-Driven Development

Copyright Š 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2016
Production reference: 1211016
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-467-5
www.packtpub.com

Credits

Author
Gaurav Sood
Copy Editors
Charlotte Carneiro
Safis Editing
Reviewer
RomĂĄn GarcĂ­a
Project Coordinator
Sheejal Shah
Commissioning Editor
Kunal Parikh
Proofreader
Safis Editing
Acquisition Editor
Chaitanya Nair
Indexer
Rekha Nair
Content Development Editor
Parshva Sheth
Graphics
Kirk D'Penha
Technical Editor
Prajakta Mhatre
Production Coordinator
Aparna Bhagat

About the Author

Gaurav Sood is a Scala and XQuery consultant who consults through his own company Omkaar Technologies Limited. He started playing with computers at a very early age and eventually went onto complete his post-graduate degree in computer sciences.
After working for an Indian software service house for a couple of years, he decided to start his own consultancy business. Since then, his company has provided services to a few Tier 1 Investment banks, the government of the United Kingdom, and publishing houses. He has gained an irrefutable reputation and distinction in the industry. Gaurav has previously worked with HSBC, Deutsche Bank, Reed Elsevier, Lexis Nexis, John Wiley & Sons, HMRC, and Associated News, amongst other smaller names in the industry.
When he is not consulting or writing, Gaurav can be seen making a fuss of his family. He likes spending time with his beautiful wife and two sons. He also loves volunteering for charity fund raising through sponsored runs. Gaurav also runs a small charitable trust in Shimla, India (New Life), which helps provide education to under-privileged children.

Acknowledgments

I would like to start by thanking God for the courage and determination to write this book. There are many people I would like to express my gratitude to, for helping me with this book. These people have seen me through this book, provided support, offered comments, proofread my work, and been a critic when I needed one.
I want to thank my family for being my strength, my parents, Satish and Brij, wife, Khushboo, and two little boys, Johan and Jairus, who have been my strength. They have supported and encouraged me in spite of all the time it took me away from them. It was a lingering and arduous voyage for them. I would also like to thank my in-laws, Hardeep and Kawaljit, along with my siblings and friends for encouraging me to consider writing this book. They have always believed in me.
I would also like to thank Packt Publishing, their extremely helpful editorial staff and technical reviewers for enabling me to publish this book and encouraging me every step of the way. I would also like to thank Artima Inc, for their permission to refer to their work.
Special thanks once again to my lovely wife Khushboo. Without you, this book wouldn’t have been possible.
Last but not the least: I beg forgiveness to all those who have been with me over the years and whose names I have failed to mention.

About the Reviewer

RomĂĄn GarcĂ­a has been a self-taught software engineer for the last two decades, and is currently CTO at Fravega.com, one of the biggest retail companies in Argentina where he resides. Previously, he worked as a software architect for Despegar.com, ZonaJobs.com, DeRemate.com, and others. An avid cowboy programmer, he is passionate about software development, clean code, test-driven development, and madly in love with the Scala programming language.
I’d like to thank my parents for all their support during the early years, when I found my passion for programming, and, last but not least, to my loving wife, Elisabeth, and my two kids, Manuela and Joaquin, for all the love they brought to my life.

www.PacktPub.com

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
www.PacktPub.com
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Preface

Test-Driven Development (TDD) goes hand-in-hand with Agile practices, which is gradually becoming the undisputed standard process or delivering quality software on time. The TDD process originated from the need to better understand and refine the requirements for a system.
Scala has gradually, despite all apprehensio...

Table of contents