SlideShare a Scribd company logo
AAA Automated Testing… For AAA Games Francesco Carucci Technical Director
 
How much does a game cost? Development costs spiraling up EA Exec: “Cost of games is crazy!” Some examples: Killzone 2: > 40 M$ Halo 3: > 30 M$ GTA 4: > 100 M$ (rumored) Clearly, this is not sustainable in the long term
Development cost partitioning To keep it simple: Producing assets Writing code (game code, technology, tools) Debugging and maintaining code Code dictates cost of producing assets Better tools means less time to create assets More efficient code means less time spent optimizing assets
Solutions? Better production frameworks SCRUM or some variation of it More experienced teams Higher senior/junior ratio actually costs less Better tools (3 rd  party engines, off the shelf packages) Out sourcing (yay for assets, nay for code) Higher quality code
Code is not the King But it’s a first class citizen and we want to keep its cost down Higher code quality  reduces Cost Of Ownership Less bugs Less over engineering Higher code quality means code easier to change and iterate upon Higher code quality means more time to be spent on polishing the game Higher code quality means less money spent to make a game! And a bigger chance to ship on time and hit that market sweet spot
Change Prevention Process Many teams follow a change management process whose main goal is to prevent “feature creep” It’s effectively a Change Prevention Process But you can’t design “fun” up front Games must be developed iteratively until “fun” is found… So? Embrace Change  
Cost of Change Game Design requirements change “ The aim system is good, but I would like it more peachy, you know a bit more of this, but slightly less of that, more rocking, less oompfh. Can you change it?” Traditionally Cost Of Change rises sharply over time “ No, I can’t change it, It would break X and Y and probably Z too, I don’t really know” We want to keep Cost Of Change as flat as possible “ Yes we can!”
Enter Automated Testing… Automated Testing  has been a broadly accepted tool for several decades in the Software Industry aimed at reducing cost of developing working code In fact…  (warning: Boring Slides Ahead)
Assessing test-driven development at IBM “ In a software development group of IBM Retail Store Solutions, we built a non-trivial software system based on a stable standard specification using a disciplined, rigorous unit testing and build approach based on the test- driven development (TDD) practice.  Using this practice, we reduced our defect rate by about 50 percent compared to a similar system that was built using an ad-hoc unit testing approach . The project completed on time with minimal development productivity impact. Additionally, the suite of automated unit test cases created via TDD is a reusable and extendable asset that will continue to improve quality over the lifetime of the software system. The test suite will be the basis for quality checks and will serve as a quality contract between all members of the team.” http://collaboration.csc.ncsu.edu/laurie/Papers/MAXIMILIEN_WILLIAMS.PDF http://portal.acm.org/citation.cfm?id=776892
An initial investigation of test driven development in industry Simposium on Applied Computing “ Test Driven Development (TDD) is a software development practice in which unit test cases are incrementally written prior to code implementation. In our research, we ran a set of structured experiments with 24 professional pair programmers. One group developed code using TDD while the other a waterfall-like approach. Both groups developed a small Java program.  We found that the TDD developers produced higher quality code,  which passed 18% more functional black box test cases. However, TDD developer pairs took 16% more time for development. A moderate correlation between time spent and the resulting quality was established upon analysis. It is conjectured that the resulting high quality of code written using the TDD practice may be due to the granularity of TDD, which may encourage more frequent and tighter verification and validation. Lastly, the programmers which followed a waterfall-like process often did not write the required automated test cases after completing their code, which might be indicative of the tendency among practitioners toward inadequate testing.  This observation supports that TDD has the potential of increasing the level of testing in the industry as testing as an integral part of code development ” http://portal.acm.org/citation.cfm?id=952753&dl=GUIDE&coll=GUIDE&CFID=46811546&CFTOKEN=92849791
Google “ Standard Google practices include unit tests and functional tests, continuous builds, last known good build, release branches with authorized bug fix check-ins, focused teams for release engineering, production engineering and QA, bug tracking and logging of production runs.” http://agile2007.agilealliance.org/index.php%3Fpage=sub%252F&id=713.html
Professionalism and Test-Driven Development   “ Test-driven development is a discipline that helps professional software developers ship clean, flexible code that works, on time. In this article, the author discusses how test-driven development can help software developers achieve a higher degree of professionalism” http://ieeexplore.ieee.org/Xplore/login.jsp?url=https%3A%2F%2Fp.rizon.top%3A443%2Fhttp%2Fieeexplore.ieee.org%2Fiel5%2F52%2F4163008%2F04163026.pdf&authDecision=-203
Unit Testing in Games “ In our experience, the introduction of automated tests and continuous integration makes development teams more efficient and results in more reliable, and often quite simply, better software. Additionally, it reduces the pressure and workload on development teams by reducing the effort for manual testing, and allows bugs to be found earlier in the development process. Certainly, automated tests alone won't make your game a hit. But almost as certainly, they will make life easier for developers, artists, project leaders, producers and even players.” http://www.gamasutra.com/features/20050329/roken_pfv.htm
Unit Testing in Games (contd…) “ Test-driven development can be a very effective development technique. We have successfully applied it to game development in a variety of situations, and we’re convinced of the many benefits it has provided us. Right now, the idea of writing code without writing tests first feels quite alien to most of us, and we treat TDD like the scaffolding in building construction: a necessary tool that will not be shipped to the customer but that helps tremendously during development” http://gamesfromwithin.com/?p=50
Unit Testing in Games (contd…) “ Wir haben in den letzten fünf Jahren ausschließlich positive Erfahrungen mit automatisierten Tests und Continuous Integration gesammelt. Die automatisierten Tests sichern Stabilität auf hohem Niveau, während Continuous Integration zusätzlich eine deutliche Arbeitserleichterung darstellt. Der Aufwand für die Einrichtung und Wartung der Verfahren ist überschaubar und hat sich schnell amortisiert. Wenn man die anfängliche Skepsis überwindet, möchte man unserer Erfahrung nach diese Art der automatisierten Qualitätssicherung sehr schnell nie mehr missen.” http://www.igda.dimajix.net/fileadmin/ressources/report-03/07_roeken_summary.pdf
What’s an Automated Unit Test A snippet of code that exercise a Unit Under Test (method of a class), assert its correctness and is executed automatically every time the system is built Running unit test is effectively a compilation step Compiler checks if the code is syntactically correct Unit tests check if the code is semantically correct
Test First vs Test Last Writing automated tests is accepted to produce higher quality code at lower cost More tests == less time spent debugging Should tests be written  after  production code? (Test-Last) Should tests be written  before  production code? (Test-First) “ This observation supports that TDD has the potential of increasing the level of testing in the industry as testing as an integral part of code development” Test Driven Development == Test-First
Test-Driven Development Write a failing test  before  the code is written Write the  simplest  code that could possibly make the test pass Refactor the code to eliminate all possible duplications and code smells Red   Green   Refactor That’s the coding rhythm
A Failing Test First write a failing test: CRY_TEST (FireButtonPressAndRelease) { StartFire(); ASSERT_IS_ TRUE (IsFiring()); } The test is dictating the interface and the contract of the unit being written: When StartFire method is invoked, the weapon is firing …  then implement the minimal code to make it pass bool IsFiring() const { return true; }
Another Failing Test Write another failing test to dictate more behavior: CRY_TEST (FireButtonPressAndRelease) {   StartFire();   St op Fire(); ASSERT_IS_ FALSE (IsFiring()); } When StartFire method is invoked, and then StopFire method is invoked, the weapon is not firing. The actual word explanation is redundant, the whole information needed is in the code itself in readable form!
Another Failing Test (contd.) Minimal implementation: bool StartFiring() { m_isFiring = true; } bool StopFiring() { m_isFiring = false; } bool IsFiring() const {   return m_isFiring; }
How does it work Tests are small, simple, straightforward and test only one condition Long and complicated tests must be avoided Tests are self documenting Tests describe the design of the code to be written Contract Invariants Post-conditions Calling conventions A TDD cycle should take few minutes (often less than a minute) 30 minutes to write a test means a bad test Break bigger tests in smaller steps (help test coverage) Begin with baby steps, increase step size when becoming more comfortable
Why TDD? Small and clearly defined steps lead to the final implementation No over engineering: write only the code that makes failing test pass Minimal maintenance Less code for the same needed functionality (including tests!)  Less time needed to change the code when requirements change Less coupling between units Less cost to maintain units Tests are a by product of design and code construction They keep contracts tested automatically through the life of the project Code is easier to modify, broken contracts easier to discover Defects and design inconsistencies are found early on It costs less to fix fewer bugs!
When TDD is not appropriate Exploratory coding,  throw away  prototype code to quickly explore different solutions for a problem But the proper solution must be implemented test-driven to reduce cost Code wrapping around existing libraries GUI layer Very low level code dealing with the hardware
Excuses for not Testing
Excuses for not Testing (contd.) …  writing tests takes time and this time is stolen from writing code People forget about the time spent debugging and maintaining code which is much larger than the time spent writing it Tests written test-first are part of the design process,  that has to be done anyway.  TDD is just a formalized way of designing code. Overall it takes  less  time to produce working code test-driven When the code base is covered, modifying code is safer and takes less time cause of regression provided by the automated tests By writing tests first, fewer bugs are experienced by working with generally tested code (no huge amount of time spent debugging)
Excuses for not Testing (contd.) …  tests can’t cover everything Some test coverage is still better than no test coverage at all Legacy code shouldn’t be tested unless it’s being refactored Rome wasn’t built in a day, but it was built eventually (and conquered the known world   )
Excuses for not Testing (contd.) …  but this code is temporary and I will change it later, I don’t need to test it now All code will be modified soon or later: making code simpler to change is the main reason to write it test-driven: reduce over engineering to the minimum, keep it simple Requirements change: modify the affected tests and production code. If unit tested, the code base is more decoupled and easier to modify with less side effects
Excuses for not Testing (contd.) …  game development is different: automated testing might not work Game development as a whole is different… …  but writing code  is the same if not simpler Game code is mostly algorithmic, which is easier to test than GUI code, for example An A* algorithm is mostly the same, be it in a game or in a web crawler Game code changes  often : more changes means more pressure for automated tests to protect against side effects
Excuses for not Testing (contd.) …  games are about fun: you can’t capture fun with automated tests But you can capture bugs, and less time spent debugging means more time looking for the “fun” part Writing a test for a bug fix ensures that bug will not resurface later on 30% of bug fixes create a new bug caused by side effects
Excuses for not Testing (contd.) …  this is AAA Game, it’s too risky to do automated testing on it AAA game means highly polished, highly technologic, great game that delivers great fun In order to achieve AAA, the most efficient production tools are needed, Automated Testing is an efficient tool It’s too risky to NOT do automated testing on a AAA game Be among the first to gain the competitive advantage and improve the Industry
A Slice of a bigger Pie Automated tests (even test-driven) don’t solve all problems  Chatting up a girl will still be a problem for a programmer   Automated tests must be part of a wider agile framework including: Continuous integration Team code ownership Daily deliverables Simple code that works Functional and Integration testing These practices work together and strengthen each other with the goal of  producing more functionalities in less time .
What’s next? More automated tests beyond Unit testing Functional testing Test more units functioning together at higher level Requires more time to build a Functional Testing Framework Can capture bugs generated by the interaction of different units Smoke testing Load different levels after every check-in looking for crashes Run scripted sequences looking for crashes Generate random inputs looking for crashes
What’s next? (contd.) Asset testing Load different assets from the engine to check for crashes and correctness Animations, Meshes, Textures Example: “ a Mesh must be smaller than 5000 polygons if it’s a character, 20000 polygons if it’s a building and must have a physics mesh smaller than 100 polygons associated” It requires metadata Run tests after every asset check-in by content creators!  Validating assets before they get into the build can save an enormous amount of debugging time
Adopting Automated Testing It doesn’t matter how much you read about it, it’s like riding a bike: you need to try it to learn it and understand it It needs strong leadership, clear vision, courage and a company willing to invest in Agile Practices Lots of money to be saved and huge competitive advantage are at stake here Don’t take decisions without understanding the issues Automated Testing often goes against perceived common practices in the Game Industry It needs a lot of mentoring and training (writing good tests is difficult) It needs strong commitment by management The whole team must be bought into it The rogue  primadonnas  unwilling to improve their skills must be removed from the team
Questions? Shoot, I can take it   Email:  [email_address] [email_address]

More Related Content

PDF
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
PPTX
게임 BM 이야기
PDF
모바일 게임기획 따라하며 배우기
PDF
국내인디게임개발자의현실
PPTX
도탑전기 분석
PDF
[NDC14] 모바일 게임의 다음 혁신 - 야생의 땅 듀랑고의 계산 프로세스 중심 게임 디자인
PDF
장재화, Replay system, NDC2011
PDF
[PandoraCube] 게임 기획자 면접 시 가장 많이 하는 질문들과 나의 답
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
게임 BM 이야기
모바일 게임기획 따라하며 배우기
국내인디게임개발자의현실
도탑전기 분석
[NDC14] 모바일 게임의 다음 혁신 - 야생의 땅 듀랑고의 계산 프로세스 중심 게임 디자인
장재화, Replay system, NDC2011
[PandoraCube] 게임 기획자 면접 시 가장 많이 하는 질문들과 나의 답

What's hot (20)

PPTX
Game design through the eyes of gaming history
PDF
게임 시스템 디자인 시작하기
PDF
게임제작개론 8
PPTX
02. 게임기획, 재미를 향한 끝없는 여정
PPTX
게임기획 포트폴리오 애니팡역기획 배상욱
PDF
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
PPTX
[IGC 2017] 넥슨코리아 심재근 - 시스템 기획자에 대한 기본 지식과 준비과정
PDF
Idle Clicker Games Presentation (Casual Connect USA 2017)
PPTX
Game Concept
PDF
김동건, 게임 디렉터가 되려면, 2008.07.04
PDF
게임회사 취업을 위한 현실적인 전략 3가지
PPTX
Part3. 아이디어를 게임기획으로 발전시키기
PDF
NDC2011 - 카메라 시스템을 통해 살펴보는 인터랙티브 시스템 개발의 문제점
PDF
[IGC2018] 캡콤 토쿠다 유야 - 몬스터헌터 월드의 게임 컨셉과 레벨 디자인
PPTX
마비노기듀얼 이야기-넥슨 김동건
PPTX
The Rise and Rise of Idle Games
PDF
코드 생성을 사용해 개발 속도 높이기 NDC2011
PDF
게임제작개론 : #9 라이브 서비스
PDF
NDC 2017 키노트: 이은석 - 다가오는 4차 산업혁명 시대의 게임개발
PDF
트레블헌터 개발기획서
Game design through the eyes of gaming history
게임 시스템 디자인 시작하기
게임제작개론 8
02. 게임기획, 재미를 향한 끝없는 여정
게임기획 포트폴리오 애니팡역기획 배상욱
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
[IGC 2017] 넥슨코리아 심재근 - 시스템 기획자에 대한 기본 지식과 준비과정
Idle Clicker Games Presentation (Casual Connect USA 2017)
Game Concept
김동건, 게임 디렉터가 되려면, 2008.07.04
게임회사 취업을 위한 현실적인 전략 3가지
Part3. 아이디어를 게임기획으로 발전시키기
NDC2011 - 카메라 시스템을 통해 살펴보는 인터랙티브 시스템 개발의 문제점
[IGC2018] 캡콤 토쿠다 유야 - 몬스터헌터 월드의 게임 컨셉과 레벨 디자인
마비노기듀얼 이야기-넥슨 김동건
The Rise and Rise of Idle Games
코드 생성을 사용해 개발 속도 높이기 NDC2011
게임제작개론 : #9 라이브 서비스
NDC 2017 키노트: 이은석 - 다가오는 4차 산업혁명 시대의 게임개발
트레블헌터 개발기획서
Ad

Viewers also liked (20)

PDF
Game Programming 06 - Automated Testing
PDF
Remote Working at Spry Fox
KEY
Best practices for writing good automated tests
PDF
What Would Blizzard Do
PDF
Game Programming 04 - Style & Design Principles
PDF
Game Programming 10 - Localization
PDF
Game Programming 08 - Tool Development
PDF
Game Programming 03 - Git Flow
PDF
Game Programming 13 - Debugging & Performance Optimization
PDF
Component-Based Entity Systems (Demo)
PDF
Game Programming 01 - Introduction
PDF
Game Programming 07 - Procedural Content Generation
PDF
School For Games 2015 - Unity Engine Basics
PDF
Tool Development A - Git
PDF
Game Programming 09 - AI
PPTX
Gamebryo LightSpeed(English)
PDF
Game Programming 02 - Component-Based Entity Systems
PDF
Game Programming 12 - Shaders
PDF
Game Programming 11 - Game Physics
PDF
Game Development Challenges
Game Programming 06 - Automated Testing
Remote Working at Spry Fox
Best practices for writing good automated tests
What Would Blizzard Do
Game Programming 04 - Style & Design Principles
Game Programming 10 - Localization
Game Programming 08 - Tool Development
Game Programming 03 - Git Flow
Game Programming 13 - Debugging & Performance Optimization
Component-Based Entity Systems (Demo)
Game Programming 01 - Introduction
Game Programming 07 - Procedural Content Generation
School For Games 2015 - Unity Engine Basics
Tool Development A - Git
Game Programming 09 - AI
Gamebryo LightSpeed(English)
Game Programming 02 - Component-Based Entity Systems
Game Programming 12 - Shaders
Game Programming 11 - Game Physics
Game Development Challenges
Ad

Similar to AAA Automated Testing (20)

PPT
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
PPTX
Unit tests & TDD
PPTX
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
PPTX
Test-Driven Development In Action
PDF
Testing: the more you do it, the more you'll like it
PPT
Why test with flex unit
PDF
A Complete Guide to Codeless Testing.pdf
PPT
Ensuring code quality
PDF
Python and test
PDF
TDD Workshop UTN 2012
PPT
Test-Driven Development
PPT
Future of QA
PPT
Futureofqa
PPT
How to run an Enterprise PHP Shop
PPT
Test Driven Development - Overview and Adoption
PDF
Testing In Software Engineering
PPTX
Making the Unstable Stable - An Intro To Testing
PPTX
Successful Software Projects - What you need to consider
PPTX
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
PPTX
#DOAW16 - DevOps@work Roma 2016 - Testing your databases
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Unit tests & TDD
assertYourself - Breaking the Theories and Assumptions of Unit Testing in Flex
Test-Driven Development In Action
Testing: the more you do it, the more you'll like it
Why test with flex unit
A Complete Guide to Codeless Testing.pdf
Ensuring code quality
Python and test
TDD Workshop UTN 2012
Test-Driven Development
Future of QA
Futureofqa
How to run an Enterprise PHP Shop
Test Driven Development - Overview and Adoption
Testing In Software Engineering
Making the Unstable Stable - An Intro To Testing
Successful Software Projects - What you need to consider
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
#DOAW16 - DevOps@work Roma 2016 - Testing your databases

Recently uploaded (20)

PPTX
OMC Textile Division Presentation 2021.pptx
PPTX
Machine Learning_overview_presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
August Patch Tuesday
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mushroom cultivation and it's methods.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Getting Started with Data Integration: FME Form 101
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Machine learning based COVID-19 study performance prediction
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
OMC Textile Division Presentation 2021.pptx
Machine Learning_overview_presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
August Patch Tuesday
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mushroom cultivation and it's methods.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Empathic Computing: Creating Shared Understanding
MIND Revenue Release Quarter 2 2025 Press Release
Getting Started with Data Integration: FME Form 101
Accuracy of neural networks in brain wave diagnosis of schizophrenia
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Machine learning based COVID-19 study performance prediction
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Group 1 Presentation -Planning and Decision Making .pptx

AAA Automated Testing

  • 1. AAA Automated Testing… For AAA Games Francesco Carucci Technical Director
  • 2.  
  • 3. How much does a game cost? Development costs spiraling up EA Exec: “Cost of games is crazy!” Some examples: Killzone 2: > 40 M$ Halo 3: > 30 M$ GTA 4: > 100 M$ (rumored) Clearly, this is not sustainable in the long term
  • 4. Development cost partitioning To keep it simple: Producing assets Writing code (game code, technology, tools) Debugging and maintaining code Code dictates cost of producing assets Better tools means less time to create assets More efficient code means less time spent optimizing assets
  • 5. Solutions? Better production frameworks SCRUM or some variation of it More experienced teams Higher senior/junior ratio actually costs less Better tools (3 rd party engines, off the shelf packages) Out sourcing (yay for assets, nay for code) Higher quality code
  • 6. Code is not the King But it’s a first class citizen and we want to keep its cost down Higher code quality reduces Cost Of Ownership Less bugs Less over engineering Higher code quality means code easier to change and iterate upon Higher code quality means more time to be spent on polishing the game Higher code quality means less money spent to make a game! And a bigger chance to ship on time and hit that market sweet spot
  • 7. Change Prevention Process Many teams follow a change management process whose main goal is to prevent “feature creep” It’s effectively a Change Prevention Process But you can’t design “fun” up front Games must be developed iteratively until “fun” is found… So? Embrace Change 
  • 8. Cost of Change Game Design requirements change “ The aim system is good, but I would like it more peachy, you know a bit more of this, but slightly less of that, more rocking, less oompfh. Can you change it?” Traditionally Cost Of Change rises sharply over time “ No, I can’t change it, It would break X and Y and probably Z too, I don’t really know” We want to keep Cost Of Change as flat as possible “ Yes we can!”
  • 9. Enter Automated Testing… Automated Testing has been a broadly accepted tool for several decades in the Software Industry aimed at reducing cost of developing working code In fact… (warning: Boring Slides Ahead)
  • 10. Assessing test-driven development at IBM “ In a software development group of IBM Retail Store Solutions, we built a non-trivial software system based on a stable standard specification using a disciplined, rigorous unit testing and build approach based on the test- driven development (TDD) practice. Using this practice, we reduced our defect rate by about 50 percent compared to a similar system that was built using an ad-hoc unit testing approach . The project completed on time with minimal development productivity impact. Additionally, the suite of automated unit test cases created via TDD is a reusable and extendable asset that will continue to improve quality over the lifetime of the software system. The test suite will be the basis for quality checks and will serve as a quality contract between all members of the team.” http://collaboration.csc.ncsu.edu/laurie/Papers/MAXIMILIEN_WILLIAMS.PDF http://portal.acm.org/citation.cfm?id=776892
  • 11. An initial investigation of test driven development in industry Simposium on Applied Computing “ Test Driven Development (TDD) is a software development practice in which unit test cases are incrementally written prior to code implementation. In our research, we ran a set of structured experiments with 24 professional pair programmers. One group developed code using TDD while the other a waterfall-like approach. Both groups developed a small Java program. We found that the TDD developers produced higher quality code, which passed 18% more functional black box test cases. However, TDD developer pairs took 16% more time for development. A moderate correlation between time spent and the resulting quality was established upon analysis. It is conjectured that the resulting high quality of code written using the TDD practice may be due to the granularity of TDD, which may encourage more frequent and tighter verification and validation. Lastly, the programmers which followed a waterfall-like process often did not write the required automated test cases after completing their code, which might be indicative of the tendency among practitioners toward inadequate testing. This observation supports that TDD has the potential of increasing the level of testing in the industry as testing as an integral part of code development ” http://portal.acm.org/citation.cfm?id=952753&dl=GUIDE&coll=GUIDE&CFID=46811546&CFTOKEN=92849791
  • 12. Google “ Standard Google practices include unit tests and functional tests, continuous builds, last known good build, release branches with authorized bug fix check-ins, focused teams for release engineering, production engineering and QA, bug tracking and logging of production runs.” http://agile2007.agilealliance.org/index.php%3Fpage=sub%252F&id=713.html
  • 13. Professionalism and Test-Driven Development “ Test-driven development is a discipline that helps professional software developers ship clean, flexible code that works, on time. In this article, the author discusses how test-driven development can help software developers achieve a higher degree of professionalism” http://ieeexplore.ieee.org/Xplore/login.jsp?url=https%3A%2F%2Fp.rizon.top%3A443%2Fhttp%2Fieeexplore.ieee.org%2Fiel5%2F52%2F4163008%2F04163026.pdf&authDecision=-203
  • 14. Unit Testing in Games “ In our experience, the introduction of automated tests and continuous integration makes development teams more efficient and results in more reliable, and often quite simply, better software. Additionally, it reduces the pressure and workload on development teams by reducing the effort for manual testing, and allows bugs to be found earlier in the development process. Certainly, automated tests alone won't make your game a hit. But almost as certainly, they will make life easier for developers, artists, project leaders, producers and even players.” http://www.gamasutra.com/features/20050329/roken_pfv.htm
  • 15. Unit Testing in Games (contd…) “ Test-driven development can be a very effective development technique. We have successfully applied it to game development in a variety of situations, and we’re convinced of the many benefits it has provided us. Right now, the idea of writing code without writing tests first feels quite alien to most of us, and we treat TDD like the scaffolding in building construction: a necessary tool that will not be shipped to the customer but that helps tremendously during development” http://gamesfromwithin.com/?p=50
  • 16. Unit Testing in Games (contd…) “ Wir haben in den letzten fünf Jahren ausschließlich positive Erfahrungen mit automatisierten Tests und Continuous Integration gesammelt. Die automatisierten Tests sichern Stabilität auf hohem Niveau, während Continuous Integration zusätzlich eine deutliche Arbeitserleichterung darstellt. Der Aufwand für die Einrichtung und Wartung der Verfahren ist überschaubar und hat sich schnell amortisiert. Wenn man die anfängliche Skepsis überwindet, möchte man unserer Erfahrung nach diese Art der automatisierten Qualitätssicherung sehr schnell nie mehr missen.” http://www.igda.dimajix.net/fileadmin/ressources/report-03/07_roeken_summary.pdf
  • 17. What’s an Automated Unit Test A snippet of code that exercise a Unit Under Test (method of a class), assert its correctness and is executed automatically every time the system is built Running unit test is effectively a compilation step Compiler checks if the code is syntactically correct Unit tests check if the code is semantically correct
  • 18. Test First vs Test Last Writing automated tests is accepted to produce higher quality code at lower cost More tests == less time spent debugging Should tests be written after production code? (Test-Last) Should tests be written before production code? (Test-First) “ This observation supports that TDD has the potential of increasing the level of testing in the industry as testing as an integral part of code development” Test Driven Development == Test-First
  • 19. Test-Driven Development Write a failing test before the code is written Write the simplest code that could possibly make the test pass Refactor the code to eliminate all possible duplications and code smells Red Green Refactor That’s the coding rhythm
  • 20. A Failing Test First write a failing test: CRY_TEST (FireButtonPressAndRelease) { StartFire(); ASSERT_IS_ TRUE (IsFiring()); } The test is dictating the interface and the contract of the unit being written: When StartFire method is invoked, the weapon is firing … then implement the minimal code to make it pass bool IsFiring() const { return true; }
  • 21. Another Failing Test Write another failing test to dictate more behavior: CRY_TEST (FireButtonPressAndRelease) { StartFire(); St op Fire(); ASSERT_IS_ FALSE (IsFiring()); } When StartFire method is invoked, and then StopFire method is invoked, the weapon is not firing. The actual word explanation is redundant, the whole information needed is in the code itself in readable form!
  • 22. Another Failing Test (contd.) Minimal implementation: bool StartFiring() { m_isFiring = true; } bool StopFiring() { m_isFiring = false; } bool IsFiring() const { return m_isFiring; }
  • 23. How does it work Tests are small, simple, straightforward and test only one condition Long and complicated tests must be avoided Tests are self documenting Tests describe the design of the code to be written Contract Invariants Post-conditions Calling conventions A TDD cycle should take few minutes (often less than a minute) 30 minutes to write a test means a bad test Break bigger tests in smaller steps (help test coverage) Begin with baby steps, increase step size when becoming more comfortable
  • 24. Why TDD? Small and clearly defined steps lead to the final implementation No over engineering: write only the code that makes failing test pass Minimal maintenance Less code for the same needed functionality (including tests!) Less time needed to change the code when requirements change Less coupling between units Less cost to maintain units Tests are a by product of design and code construction They keep contracts tested automatically through the life of the project Code is easier to modify, broken contracts easier to discover Defects and design inconsistencies are found early on It costs less to fix fewer bugs!
  • 25. When TDD is not appropriate Exploratory coding, throw away prototype code to quickly explore different solutions for a problem But the proper solution must be implemented test-driven to reduce cost Code wrapping around existing libraries GUI layer Very low level code dealing with the hardware
  • 26. Excuses for not Testing
  • 27. Excuses for not Testing (contd.) … writing tests takes time and this time is stolen from writing code People forget about the time spent debugging and maintaining code which is much larger than the time spent writing it Tests written test-first are part of the design process, that has to be done anyway. TDD is just a formalized way of designing code. Overall it takes less time to produce working code test-driven When the code base is covered, modifying code is safer and takes less time cause of regression provided by the automated tests By writing tests first, fewer bugs are experienced by working with generally tested code (no huge amount of time spent debugging)
  • 28. Excuses for not Testing (contd.) … tests can’t cover everything Some test coverage is still better than no test coverage at all Legacy code shouldn’t be tested unless it’s being refactored Rome wasn’t built in a day, but it was built eventually (and conquered the known world  )
  • 29. Excuses for not Testing (contd.) … but this code is temporary and I will change it later, I don’t need to test it now All code will be modified soon or later: making code simpler to change is the main reason to write it test-driven: reduce over engineering to the minimum, keep it simple Requirements change: modify the affected tests and production code. If unit tested, the code base is more decoupled and easier to modify with less side effects
  • 30. Excuses for not Testing (contd.) … game development is different: automated testing might not work Game development as a whole is different… … but writing code is the same if not simpler Game code is mostly algorithmic, which is easier to test than GUI code, for example An A* algorithm is mostly the same, be it in a game or in a web crawler Game code changes often : more changes means more pressure for automated tests to protect against side effects
  • 31. Excuses for not Testing (contd.) … games are about fun: you can’t capture fun with automated tests But you can capture bugs, and less time spent debugging means more time looking for the “fun” part Writing a test for a bug fix ensures that bug will not resurface later on 30% of bug fixes create a new bug caused by side effects
  • 32. Excuses for not Testing (contd.) … this is AAA Game, it’s too risky to do automated testing on it AAA game means highly polished, highly technologic, great game that delivers great fun In order to achieve AAA, the most efficient production tools are needed, Automated Testing is an efficient tool It’s too risky to NOT do automated testing on a AAA game Be among the first to gain the competitive advantage and improve the Industry
  • 33. A Slice of a bigger Pie Automated tests (even test-driven) don’t solve all problems Chatting up a girl will still be a problem for a programmer  Automated tests must be part of a wider agile framework including: Continuous integration Team code ownership Daily deliverables Simple code that works Functional and Integration testing These practices work together and strengthen each other with the goal of producing more functionalities in less time .
  • 34. What’s next? More automated tests beyond Unit testing Functional testing Test more units functioning together at higher level Requires more time to build a Functional Testing Framework Can capture bugs generated by the interaction of different units Smoke testing Load different levels after every check-in looking for crashes Run scripted sequences looking for crashes Generate random inputs looking for crashes
  • 35. What’s next? (contd.) Asset testing Load different assets from the engine to check for crashes and correctness Animations, Meshes, Textures Example: “ a Mesh must be smaller than 5000 polygons if it’s a character, 20000 polygons if it’s a building and must have a physics mesh smaller than 100 polygons associated” It requires metadata Run tests after every asset check-in by content creators! Validating assets before they get into the build can save an enormous amount of debugging time
  • 36. Adopting Automated Testing It doesn’t matter how much you read about it, it’s like riding a bike: you need to try it to learn it and understand it It needs strong leadership, clear vision, courage and a company willing to invest in Agile Practices Lots of money to be saved and huge competitive advantage are at stake here Don’t take decisions without understanding the issues Automated Testing often goes against perceived common practices in the Game Industry It needs a lot of mentoring and training (writing good tests is difficult) It needs strong commitment by management The whole team must be bought into it The rogue primadonnas unwilling to improve their skills must be removed from the team
  • 37. Questions? Shoot, I can take it  Email: [email_address] [email_address]