-
Book Overview & Buying
-
Table Of Contents
Supercharged Coding with GenAI
By :
One aspect of testing is the availability of data that is representative of the kind you will encounter in the wild. If you have been involved in creating mock data in years past, you will certainly appreciate GenAI approaches to this problem. The new techniques can create a variety of types of data with as specific a prompt as you need. For example, the following prompt works in either ChatGPT or GitHub Copilot:
create a table with 10 rows and the following columns:
5 digit integer id called "ID"
first name
last name
address consisting of a number, street name, and whether it is a st., dr. or ave.
city
country
disease
age
The resulting table output is shown in Figure 13.13, which includes typical names, address formats, diseases, and so on. This kind of data can be saved to a file and used for testing. Although such data could be generated on the fly, the purpose of unit testing is to create repeatable tests that achieve consistent...