-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

How to Test a Time Machine
By :

As discussed in the last two sections, automation can be used to avoid repetitive code, both in unit testing and during mocking. In fact, mocking libraries are partially doing that very same thing. Furthermore, some integrated development environments (IDEs), such as IntelliJ IDEA, already have integrated plugins that can insert code automatically, and even create unit test classes. Visual Studio Code (VS Code) has several community-driven extensions that can automate these and other tasks that you are currently doing manually.
The first requirement to write automation over code is to be able to extract pieces of that code and give meaning to those pieces. This is usually done using an abstract syntax tree (AST) to represent this code:
ast
library (see [1] in the Further reading section at the end of the chapter) provides the methods to create one