Test-Driven Development (TDD) Process

slide1 n.w
1 / 35
Embed
Share

Explore the Test-Driven Development (TDD) process, an Agile software development approach involving writing automated unit tests, assertions, refactoring, and code implementation in iterative cycles. Learn about the benefits and cautionary aspects of TDD to enhance software development practices.

  • TDD Process
  • Agile Development
  • Unit Testing
  • Refactoring
  • Software Development

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. TDD elaborate 2011-06-10

  2. This is not a whole story of TDD. This is not a whole story of developing Actually, there is no neat end of developing :P

  3. ,,, printf, print, system.out.println, print_r ( ) (A B B C C A ) , , !

  4. :

  5. , ? . . !

  6. What is TDD? Test Driven Development http://en.wikipedia.org/wiki/Test-driven_development It is a Software Development Process Family of Agile Key words Automated unit tests Assertions Refactoring Writing a code

  7. Be careful! TDD is not an omniscience technique! Usually, imported as part of process However, if you decided, please keep it during development

  8. TDD Process A Process cycle is composed in 4-5 stages Adding a test Running a test and check Writing code Testing again Refactoring the code

  9. Process Diagram Refactoring

  10. ( ) TODO List Backlog TDD Review 3 TODO List

  11. Good to Frameworks! JUnit (Java unit test framework) Python unit test module import unittest What relation? Django unit test module from django.utils import unittest A lot of unit testing frameworks http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks xUnit is a general term for unit test frameworks

  12. ! What is Agile? What is Unit test? What is Assertion? What is Refactoring? What is Framework?

  13. Agile A group of software development http://en.wikipedia.org/wiki/Agile_software_development http://agilemanifesto.org/ Break tasks into Short term work Cross function, self organizing Face to Face communication Customer Representatives Each routine should make working software For a short term project not a 10 year project, over 50 people project Matched to the current trend of software development

  14. All right.. Let s see examples Bowling Scoring Program (Java with Junit) (Python with Django test)

  15. Bowling Score Do you like bowling? Have you ever have a question about how bowling score is graded? I didn t know until this seminar

  16. Bowling keyword Game Throw Frame Spare Strike Understandable???

  17. Start of thinking What can happen in Bowling Game? When a ball is thrown add knock downed pins Want to know score of a frame Want to total score of a current game

  18. Thinking of Tests Start of thinking Test Cases Adding score Getting Score Of a Frame Getting Total score

  19. Write test codes public void testGameStart() { Game g = new Game(); assertEquals(0, g.getScoreOfFrame(0)); assertEquals(0, g.score()); } Understandable??? public void testThrowOnce() { setUp(); game.add(5); assertEquals(5, game.score()); } Any question??? public void testThrowTwice() { setUp(); game.add(5); game.add(6); assertEquals(11, game.score()); }

  20. More test codes public void testThrowWithSpare() { setUp(); game.add(3); game.add(7); game.add(6); game.add(2); assertEquals(16, game.getScoreOfFrame(1)); // 3 + 7 + (6) } Understandable??? public void testThrowWithStrike() { setUp(); game.add(10); game.add(7); game.add(1); assertEquals(18, game.getScoreOfFrame(1)); // 10 + (7+1) } Any question???

  21. Practice Let s see Eclipse We will cover there Quite lots of explanation would be given

  22. ( ) : Sigma ( * ) / Sigma( )

  23. Specification Web based Users would have simple Interface , (input) (get) (result) Django 3

  24. Like this! <form action="get.html" method="get"> <div> <input type="text" size="5"> <input type="submit" value="Get!"> </div> </form> <form action="result.html" method="post"> <div> <input type="text" name="s1"> <select name="g1"> <option value="1">A+</option> <option value="2">A0</option> <option value="3">A-</option> </select> </div>

  25. Start Django You already know django-admin startproject gpa django-admin startapp input django-admin startapp get django-admin startapp result I know it is redundant work

  26. Thinking of Tests Right inputs Right formats and values of POST, GET Right Result of GPA

  27. Practice Let s see vim We will cover there It seems to be easy, huh? But, there would be quite a lot of explanation

  28. This not end!!!

  29. Category of Tests Authentication Test DB Test HTTP Test Everything can be tested and should be tested

  30. Be Careful again Don t be afraid of Failing Tests! Fail is mother of pass?!?! Be thoughtful when you writing a Test Don t think whole at once Don t make testing lead you, you must lead the tests!

  31. Please Study hard! TDD , framework (1/8) Reference

  32. It Looks Hard No, it s not that hard I just make it verbose to show you This seminar is not that practical Always, first time is hard More trials, more easy work

  33. Keep it mind Homework I will check if there are test cases in your mini-project next week Be prepared!

  34. Q&A Thanks Special thanks to Combacsa

  35. Reference http://www.agiledata.org/essays/tdd.html http://www.martinfowler.com/bliki/Xunit.html http://en.wikipedia.org/wiki/Test_automation http://en.wikipedia.org/wiki/XUnit http://en.wikipedia.org/wiki/Test-driven_development https://docs.djangoproject.com/en/dev/topics/testing/ http://www.junit.org/ http://en.wikipedia.org/wiki/Agile_software_development http://agilemanifesto.org/ http://sparcs.org/seminar/attachment/combacsa-20100612-2.pptx

More Related Content