reinforcement learning to write java unit tests
play

Reinforcement Learning To Write Java Unit Tests Mathew Lodge - PowerPoint PPT Presentation

Reinforcement Learning To Write Java Unit Tests Mathew Lodge Diffblue: AI For Code 1 Talk in a nutshell: In the same way AI can search for the best Go move, AI can search for the best unit test Continuous Integration In Theory Write Code


  1. Reinforcement Learning To Write Java Unit Tests Mathew Lodge

  2. Diffblue: AI For Code 1

  3. Talk in a nutshell: In the same way AI can search for the best Go move, AI can search for the best unit test

  4. Continuous Integration In Theory Write Code Commit Unit Tests Integrate Full Tests Deploy

  5. Continuous Integration in Practice Uncaught Errors Result in Broken Pipelines and Low Velocity Write Code Commit Tests? Integrate Full Tests Time to find & fix errors Minutes Hours Hours to Days

  6. What is AI?

  7. Code Transforms Input to Output Q: 26,464*36,361/4? A: 240,564,376

  8. Limitations Of Human Coding Q: What’s this? A: ????

  9. AI: Computer Iterates on Statistical Model That Relates Input To Output AI Model A: Q: What’s this? 91% Cat 23% Tabby 86% Dog 32% Spaniel 11% Pebble

  10. AI: Not Artificial, Not Intelligent • Not Artificial: Solves real problems programmers cannot reach • Not Intelligent: Just maths • Great when you can’t brute-force the problem

  11. Reinforcement Learning AI in AlphaGo

  12. Go Is A Hard Game To Automate • Far more possible moves than Chess: ~10 170 • ~10 92 atoms in the known universe • Long-term strategy makes a big difference in Go • Hard to tell if a move is good until much later

  13. Reinforcement Learning In General Observation Action Environment Reward Update Evaluate Model State update

  14. AlphaGo Go Moves Algorithm Play Game Reward Updated AlphaGo Neural Evaluation Networks State update

  15. AlphaGo Is Probabilistic Search Of The Go Gameplay Space • Monte Carlo to generate potential moves • “Policy” neural network predicts best next move • “Value” neural network predicts who will win

  16. Monte Carlo With Prediction

  17. What Does This Have To Do With Java Testing Or DevOps?

  18. Testing As Search Of Program Space Set of All Possible Test Programs Programs that are valid and run High coverage tests Tests that developers find easy to read

  19. Test Writing Is Hard To Automate • Exponential search space • Complex interdependencies between program and data • Hard to tell if a test is “good” • Practical difficulties: IO, frameworks, dynamic typing, semantic understanding, idiomatic code

  20. Diffblue Reinforcement Learning Coverage + Results Test Candidate JVM Reward Existing Java code Test mutation Evaluator Test Writer

  21. Unsupervised Learning Very Fast Can Run On A Dev Laptop

  22. Demo

  23. Diffblue AI Writes Unit Test Suites • Run quickly • Run early • Find unit-level errors • Improve coverage • Are easy to understand

  24. Typical Software Lifecycle Engineer No updates Engineer Is the code Running Pull Request Run tests writes code change code change correct? PR approved Yes

  25. Lifecycle with Diffblue Cover Engineer No updates Engineer Is the code Running Run tests + Pull Request writes code change code Diffblue suite change correct? PR approved Yes Regression Unit AI writes Diffblue AI Test Suite tests from updates Unit current code Test Suite

  26. Diffblue At Goldman Sachs . 2x better test coverage (70%) . 10x faster than manual coding

  27. Summary • Lack of tests to run early in pipeline is a key DevOps blocker • Diffblue Cover AI writes unit tests for your current Java code • Cover is 10-100x faster than manual test writing

  28. Free trials available at Diffblue.com Any Questions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend