I had a perfect case for test automation for my team. I work on mortgages and we had an example of how we could add more coverage. Using a combination of Postman smoke tests and C# with MSTest. When it comes to compliance there is a matrix of details we need to cover.
Using an end-to-end test I was able to use GitHub Copilot to generate the MSTest data rows with an API that will return a response with the right status code. Through this experience I was able to write a simple loop using the API and cover more cases than ever before.
Without AI and GitHub copilot I don’t think I would have had the ability or time to structure a test to this degree. It’s not perfect but it took a mundane task into an exciting and thrilling adventure.
AI is coming to Xcode, so there is that. I think the trouble is that if AI writes some code for you, and you sue (sic) it verbatim in any shipping code, that you can then be liable for theft if the AI lifted that code from a non-GPL repo (other licenses do apply to other businesses). To this end copy-paste of AI code is banned in most companies because we all know that test code can sometimes find it’s way into production code. It does happen more often than you think.
So while AI might be banned in many workplaces, I’m keen to see practical uses that actually don’t require jumping through hurdles. Right now I spend more time in reporting the logs and evidence of defects, than I do wondering if an AI will help me find even more ones because things are moving far too fast for AI to be useful yet.
In my case I needed to add a new series of classes for running an integration test. We have an existing API that mocks responses from that API. I created a Postman collection however it was tedious. In C# I was able to use GitHub Copilot to keep asking questions and try it out. GitHub has a lot of information on how to write these types of tests. I took an existing version and customized for more assertions.
The value the AI gave me was the organization and form on how to write it. It took me a few days to write my tests and the AI was not always helpful either. If I didn’t have AI I wouldn’t have bothered to try to add more coverage.