Writing tests with AI-assisted coding
In this recipe, we will try out a really useful function of AI-assisted coding: test writing. Tools such as ChatGPT can help you write a variety of tests automatically for your code. This helps ensure completeness and accuracy. We will take the code from read alignment work in the Read alignment, recipe and write some tests for it.
Go into ChatGPT and get ready to write a prompt to add testing code for the alignment function that we just wrote in the Read alignment recipe.
How to do it...
Here are the steps to try this recipe:
- We’ll begin by writing a prompt to develop testing code for the alignment code we wrote in the previous recipe (make sure it is still available in ChatGPT; if it’s not, then run the examples from the Sequence manipulation and Read alignment recipes first). Here’s the prompt:
Write test code forthe above.
Note
We can be very generic with our instructions with ChatGPT. We could...