Writing Tests with AI-assisted coding
In this recipe we will try out a really useful function of AI-Assisted coding: test writing. Tools like 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 Recipe 3-3, Read Alignment 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 Recipe 3.3
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 for the above
Note
We can be very generic with our instructions with ChatGPT. We could have said “write unit tests” or...