Book Image

Jasmine Cookbook

By : Munish Kumar
Book Image

Jasmine Cookbook

By: Munish Kumar

Overview of this book

Table of Contents (16 chapters)
Jasmine Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Designing Jasmine tests for existing code using TDD and BDD


Writing Jasmine tests for existing code is tricky compared to writing Jasmine tests for new code. Consider that you are updating the existing code against a change request. Then, there can be the following situations where you write Jasmine tests with the existing code:

  • The existing code is developed without using TDD and BDD processes and no test is written for the existing code.

  • The existing code is developed without using TDD and BDD processes. However, Jasmine tests are developed for the existing code.

  • The existing code is developed using TDD and BDD processes and Jasmine tests are already written for the existing code.

Whatever the scenario is valid for you from the above list, but when we implement a new feature or functionality, it’s recommended to develop Jasmine tests only for the new piece of code. Also, if Jasmine tests are not written for the existing code, then we need to develop the tests only for the code that is impacted...