In this article, I will demonstrate how I am using ChatGPT to write unit tests for our system in a consistent and predictable fashion. I was curious if I could take the scopes from our code and use ChatGPT to generate unit tests for them. ChatGPT was able to come up with a couple of unit tests, but they needed some modifications to work within our system. By providing additional contextual information, I was able to improve the generated code. I decided to further test ChatGPT by using it to generate unit tests for more complex scopes. I provided it with a copy of our code and asked it to create tests for specific scopes. ChatGPT generated multiple tests, some of which worked perfectly and others that uncovered bugs in our code. This ability to uncover unknown problems is a powerful aspect of unit testing.
 
             
     
     
                   
                   
                  