Pragmatic Test Driving Development.

838 vues

Publié le

Использование TDD в Embedded Linux разработке.
Смешивание unit-тестирования и функционального тестирования.
Инструменты : cunit/check, интеграция с make, gcov/ggcov

Publié dans : Technologie
0 commentaire
0 j’aime
Statistiques
Remarques
  • Soyez le premier à commenter

  • Soyez le premier à aimer ceci

Aucun téléchargement
Vues
Nombre de vues
838
Sur SlideShare
0
Issues des intégrations
0
Intégrations
8
Actions
Partages
0
Téléchargements
11
Commentaires
0
J’aime
0
Intégrations 0
Aucune incorporation

Aucune remarque pour cette diapositive

Pragmatic Test Driving Development.

  1. 1. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Test Driven Development. Ïðàêòèêà Âëàä 'mend0za' Øàõîâ Linux and Embedded department SaM Solutions March 2012 SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  2. 2. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Outline: Êðàòêîå ñîäåðæàíèå è òåìû þíèò-òåñòèðîâàíèå ôóíêöèîíàëüíîå òåñòèðîâàíèå çàïóñê òåñòîâ è ïðîâåðêà ðåçóëüòàòîâ êîíòðîëü ïîêðûòèÿ òåñòàìè êîäà óòèëèòû è áèáëèîòåêè (Free Software) íà ïðèìåðå 2õ ðåàëüíûõ embedded ïðîåêòîâ äëÿ ÿçûêà ïðîãðàììèðîâàíèÿ Ñè SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  3. 3. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà À íàäî ëè âîîáùå òåñòèðîâàòü? Çà÷åì êîçå áàÿí TDD ? SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  4. 4. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðè÷èíû ïî÷åìó ÄÀ òåñòèðóåò ñàì ðàçðàáîò÷èê ýòî òîæå ïðîãðàììèðîâàíèå SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  5. 5. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðè÷èíû ïî÷åìó ÄÀ òåñòèðóåò ñàì ðàçðàáîò÷èê ýòî òîæå ïðîãðàììèðîâàíèå ñîîòâåñòâèå òðåáîâàíèÿì ãàðàíòèÿ, ÷òî âàø êîä äåëàåò âñ¼ êàê íàäî SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  6. 6. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðè÷èíû ïî÷åìó ÄÀ òåñòèðóåò ñàì ðàçðàáîò÷èê ýòî òîæå ïðîãðàììèðîâàíèå ñîîòâåñòâèå òðåáîâàíèÿì ãàðàíòèÿ, ÷òî âàø êîä äåëàåò âñ¼ êàê íàäî êîíòðîëü êîððåêòíîñòè èçìåíåíèé èñïðàâëåíèÿ ëåãêî ïðîâåðèòü ïðîñòî çàïóñòèâ òåñòû SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  7. 7. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðè÷èíû ïî÷åìó ÄÀ òåñòèðóåò ñàì ðàçðàáîò÷èê ýòî òîæå ïðîãðàììèðîâàíèå ñîîòâåñòâèå òðåáîâàíèÿì ãàðàíòèÿ, ÷òî âàø êîä äåëàåò âñ¼ êàê íàäî êîíòðîëü êîððåêòíîñòè èçìåíåíèé èñïðàâëåíèÿ ëåãêî ïðîâåðèòü ïðîñòî çàïóñòèâ òåñòû ìåíåäæåðü¼ è çàêàç÷èêè ëþáÿò êðàñèâûå öèôðû TDD äàñò öèôðû äëÿ îò÷¼òà SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  8. 8. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðè÷èíû ïî÷åìó ÄÀ òåñòèðóåò ñàì ðàçðàáîò÷èê ýòî òîæå ïðîãðàììèðîâàíèå ñîîòâåñòâèå òðåáîâàíèÿì ãàðàíòèÿ, ÷òî âàø êîä äåëàåò âñ¼ êàê íàäî êîíòðîëü êîððåêòíîñòè èçìåíåíèé èñïðàâëåíèÿ ëåãêî ïðîâåðèòü ïðîñòî çàïóñòèâ òåñòû ìåíåäæåðü¼ è çàêàç÷èêè ëþáÿò êðàñèâûå öèôðû TDD äàñò öèôðû äëÿ îò÷¼òà èòîãî êà÷åñòâî è óïðàâëÿåìîñòü ðàçðàáîòêè óëó÷øèòñÿ SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  9. 9. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Âíåäðåíèå. Ïðîñòûå ðåöåïòû Òåñòû áåç ïðîâåðêè ïîêðûòèÿ - áåñïîëåçíû Sad but true a a Metallica c 1993 Sad but true single SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  10. 10. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Âíåäðåíèå. Ïðîñòûå ðåöåïòû Òåñòû áåç ïðîâåðêè ïîêðûòèÿ - áåñïîëåçíû Sad but true a a Metallica c 1993 Sad but true single Ìàëåíüêèé ïðîåêò - ïðîñòûå ïðîöåññû SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  11. 11. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Âíåäðåíèå. Ïðîñòûå ðåöåïòû Òåñòû áåç ïðîâåðêè ïîêðûòèÿ - áåñïîëåçíû Sad but true a a Metallica c 1993 Sad but true single Ìàëåíüêèé ïðîåêò - ïðîñòûå ïðîöåññû Áîëüøîé ïðîåêò - ãåìîððîéíûå èíñòðóìåíòû Rational R Purify R íàïðèìåð SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  12. 12. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Âíåäðåíèå. Ïðîñòûå ðåöåïòû Òåñòû áåç ïðîâåðêè ïîêðûòèÿ - áåñïîëåçíû Sad but true a a Metallica c 1993 Sad but true single Ìàëåíüêèé ïðîåêò - ïðîñòûå ïðîöåññû Áîëüøîé ïðîåêò - ãåìîððîéíûå èíñòðóìåíòû Rational R Purify R íàïðèìåð Ôèçèêà çàêîíû ìàêðîìèðà è ìèêðîìèðà îòëè÷àþòñÿ êîðåííûì îáðàçîì SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  13. 13. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ñáîðî÷íàÿ ñèñòåìà 1 Äîáàâëÿåì êîìïèëÿöèþ òåñòîâ â ñáîðêó 2 Âêëþ÷àåì ïîäñ÷¼ò ïîêðûòèÿ gcov : CFLAGS+= - -coverage 1 CFLAGS + = −DDEBUG (DEBUG) −g −− c o v e r a g e =$ BINARY_TEST = unit_test 3 OBJ_TEST = 5 $ (BINARY_TEST) : $ (CC) test / test . o $ ( OBJ) $ (CFLAGS) source / fts_binsearchtree . o $ (OBJ_TEST) $ (LDFLAGS) −o $@ $^ / usr / l i b / libcheck . a 7 check : 9 $ (BINARY_TEST) . / $ (BINARY_TEST) $ (CONFIG_SPACE_PATH) $ (CONFIG_SPACE_PATH) [ SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  14. 14. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Êàê ðàçðàáàòûâàåì 1: êîä è òåñòû test/test.c 1 START_TEST( c o n f i g _ s p a c e _ c h e c k _ t e s t ) { int 3 ret = c o n f i g _ s p a c e _ c h e c k ( nvram_basedir , BMCInst ) ; fail_if ( ret return 5 != −1 , config_space_check ( ) must −1 ) ; } END_TEST SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  15. 15. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Êàê ðàçðàáàòûâàåì 2: êîìïèëÿöèÿ è çàïóñê test/test.c $ make check 96%: Checks: 27, Failures: 1, Errors: 0 test/test.c:54:F:Cong Space:test_init:0: path should not open test/test.c:1524:P:Cong Space:cong_space_check_test:0: Passed test/test.c:1561:P:Cong Space:string_with_zero_test:0: Passed test/test.c:1595:P:Cong Space:migration_test:0: Passed SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  16. 16. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Êàê ðàçðàáàòûâàåì 3: ïðîâåðêà ïîêðûòèÿ ïðîâåðêà ïîêðûòèÿ ãäå îòðàáîòàëè, ãäå íå âîøëè + ñòàòèñòèêà SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  17. 17. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Êàê ðàçðàáàòûâàåì 3: ïðîâåðêà ïîêðûòèÿ ïðîâåðêà ïîêðûòèÿ ãäå îòðàáîòàëè, ãäå íå âîøëè + ñòàòèñòèêà ggcov SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  18. 18. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðèìåð 1. Áèáëèîòåêà ñ âíåøíèì API Ïðîåêò: ïðîøèâêà BMC ñåðâåðîâ Fujitsu Primergy Íàçíà÷åíèå: óïðàâëåíèå ïåðåìåííûìè äëÿ IPMI-ñòåêà Ðîëü TDD: òîëüêî Unit-òåñòèðîâàíèå Èíñòðóìåíû è ëèáû TDD: check, gcc/gcov, ggcov SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  19. 19. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Ïðèìåð 2. Óïðàâëÿþùåå ÏÎ ïðîøèâêè Ïðîåêò: 4-õ êàíàëüíûé âèäåîðåãèñòðàòîð Íàçíà÷åíèå: óïðàâëÿþùåå ÏÎ â user-space Ðîëü TDD: Unit Testing, Functional Testing, Integration Testing, ýìóëÿöèÿ îáîðóäîâàíèÿ Èíñòðóìåíû è ëèáû TDD: cunit, make, gcc/gcov, ggcov, Linux Kernel SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  20. 20. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà èíñòðóìåíòû Unit-test frameworks 1. check - http://check.sourceforge.net 2. cunit - http://cunit.sourceforge.net Coverage tools 3. Ðàñøèðåíèå gcov - âñòðîåíî â GCC (- -coverage) 4. ggcov tool - http://ggcov.sourceforge.net Âåñü èíñòðóìåíòàðèé - äîñòóïåí â äèñòðèáóòèâàõ, ïîä ñâîáîäíûìè ëèöåíçèÿìè SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà
  21. 21. Intro Ìîòèâàöèîííàÿ Âíåäðåíèå Ïðàêòèêà Âîïðîñû? Âàøè âîïðîñû www: http://www.sam-solutions.com email: v.shakhov@sam-solutions.net jabber: mend0za@jabber.org.by SaM Solutions: Linux and Embedded department Test Driven Development. Ïðàêòèêà

×