Book Image

Learn PowerShell Core 6.0

By : David das Neves, Jan-Hendrik Peters
Book Image

Learn PowerShell Core 6.0

By: David das Neves, Jan-Hendrik Peters

Overview of this book

Beginning with an overview of the different versions of PowerShell, Learn PowerShell Core 6.0 introduces you to VSCode and then dives into helping you understand the basic techniques in PowerShell scripting. You will cover advanced coding techniques, learn how to write reusable code as well as store and load data with PowerShell. This book will help you understand PowerShell security and Just Enough Administration, enabling you to create your own PowerShell repository. The last set of chapters will guide you in setting up, configuring, and working with Release Pipelines in VSCode and VSTS, and help you understand PowerShell DSC. In addition to this, you will learn how to use PowerShell with Windows, Azure, Microsoft Online Services, SCCM, and SQL Server. The final chapter will provide you with some use cases and pro tips. By the end of this book, you will be able to create professional reusable code using security insight and knowledge of working with PowerShell Core 6.0 and its most important capabilities.
Table of Contents (26 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Test-driven development


Test-driven development plays a very important role in DevOps. The Wikipedia definition (https://en.wikipedia.org/wiki/Test-driven_development) of test-driven development is this:

"A software development process that relies on the repetition of a very short development cycle: requirements are turned into very specific test cases, then the software is improved to pass the new tests, only."

By knowing your requirements so well that you can write test cases that accurately reflect those requirements, you automatically write fitting code. This is usually done by developing solid test cases first that test the so-called happy path. All code is then developed so that the test cases pass.

The benefit of this approach is that no unnecessary code is produced, since the code only needs to satisfy the requirements. TDD also leads to modularization of the code. This is something we do in PowerShell anyway and that should by now sound familiar; functions and cmdlets should only have...