SlideShare a Scribd company logo
1 of 27
Download to read offline
PyCon JP 2011 LT




        Oktest
a new style testing library for Python


                 makoto kuwata
          http://www.kuwata-lab.com/


        copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                              1
unittest
           (python)


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        2
Too long! Hard to read & write!
                                     !                                  !




                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                            3
Test::More
                  (perl)


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        4
Easy to read & write! Kool!




      copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                              5
Oktest
           (python)


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        6
So Kooooooool!



                  copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                          7
Kool Python!                                         Not kool. It's Java.
     Python                                                      Java




                            copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                                   8
ok() returns AssertionObject
                                  ok()        AssertionObject

       	    	 
                                                              	 

       	    	 
                     	                 	                   	             	 
	 	 
                                       	  	          	  	  	 
                                      Overrides '==' operator
                                       '=='




                 copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                              9
Shows unified diff when '==' is failed.
	                                 '=='                    uniifed diff             (2.6   !)




                           copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                               10
Test Code                                 When Failed
  	          	 	 	 	 	 	 	 	 	 
        	  	  	  	 	 	 	 	 	 (no message)

  	       	 	 	 	 	 	 	 	 	 	 	 
       	  	  	 	 	 	 	 	 	 	 (no message)

  	          	 	 	 	 	 	 	 	 	 
  	     	  	  	 	 	 	 	 	 	 	  	  	  	  	 

                  Shows actual & expected values


            copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                    11
unittest
           (python)


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        12
You must describe in [a-zA-Z0-9_]+
                                (         )                             _
         	 

	 	      	 
	 	 	 	          	  	  	                         	        	 
	 	 	 	                                                      	 

                         Duplicated. Not DRY!
                                                          DRY




                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                            13
Oktest
           (python)


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        14
Free text instead of method name!
                                                                        !




                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                            15
Any symbol or CJK available!



                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                        16
internal

                  	 	  	             	  	  	                           	    	 
                    	  	                           	 
	 	 	 	 	 	 	 	 	 	 	 	 	            	  	  	                           	    	 
                                                   	  	 
                 Set free text as method name,
               keeping with unittest compatibility
               unittest



               copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                 17
Fixture Injection
            in Oktest


   copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                           18
All test methods call the same 'setUp()'. Coarse-grained.
 Want to call different initializer for each test method.
                                 setUp()


         	 

	 	      	 
	 	 	 	                      	  	 
	 	 	 	                  	 	 	  	 

	 	      	 
	 	 	 	  	                                              	       	 

	 	      	 
	 	 	 	  	                                         	       	 
              copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                      19
Calls provide_member() only
	 	      	                                         	 
	 	 	 	  	                                 	       	 
	 	      	                                    	 
	 	 	 	  	                            	       	 
                                                        Calls provide_team() only

              copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                    20
- 'A' depends on 'B' and 'C'
                                     - 'C' depends on 'D'
                                       A B C                      C     D

	 	      	                                    	                   	 
	 	      	                              	 	 	 	                   	 
	 	      	                                	 	 	                   	 
	 	      	                              	 	 	 	                   	 

	 	       	                                                    	 
	 	 	 	 	 	    	        	       	               	            	              	 
                    Dependencies are resolved automatically
                                           Oktest


                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                 21
Equivarent to setUp()
                                        provide_xxx()       setUp()

	 	       	 
	 	 	 	                  	  	 
	 	 	 	        	                                     	            	     	 
	 	 	 	 	 	 
	 	 	 	             	 
                                  Equivarent to tearDown()
                                     release_xxx()        tearDown()

	 	       	                                                	 
	 	 	 	  	 
	 	 	 	 	 	 

                copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                             22
Interested?


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        23
Oktest Python                                       Google Search




     copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                    24
one more thing...


  copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                          25
Oktest for Node.js
      	             	    	 
	 	 	 	           	 	    	 
	 	 	 	         	 	 	    	 
	 	 	 	     	 	 	 	 	    	 

                                    	                      	 
	 	                                                	                    	 
	 	 	 	                                                    	                 	 
	 	 	 	 	 	     	 
	 	 	 	 	 	     	             	          	 
	 	 	 	 
	 	 


    	                                 	       	 
	 	 

                     copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                                                  26
thank you


copyright(c) 2011 kuwata-lab.com all rights reserved.
                                                        27

More Related Content

More from kwatch

How to make the fastest Router in Python
How to make the fastest Router in PythonHow to make the fastest Router in Python
How to make the fastest Router in Pythonkwatch
 
Migr8.rb チュートリアル
Migr8.rb チュートリアルMigr8.rb チュートリアル
Migr8.rb チュートリアルkwatch
 
なんでもID
なんでもIDなんでもID
なんでもIDkwatch
 
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方kwatch
 
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方kwatch
 
O/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐO/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐkwatch
 
正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?kwatch
 
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)kwatch
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!kwatch
 
PHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するPHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するkwatch
 
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?kwatch
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Pythonkwatch
 
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策kwatch
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門kwatch
 
Pretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/MercurialPretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/Mercurialkwatch
 
文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみたkwatch
 
I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"kwatch
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラムkwatch
 
Javaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンJavaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンkwatch
 
Underlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R MapperUnderlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R Mapperkwatch
 

More from kwatch (20)

How to make the fastest Router in Python
How to make the fastest Router in PythonHow to make the fastest Router in Python
How to make the fastest Router in Python
 
Migr8.rb チュートリアル
Migr8.rb チュートリアルMigr8.rb チュートリアル
Migr8.rb チュートリアル
 
なんでもID
なんでもIDなんでもID
なんでもID
 
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
Nippondanji氏に怒られても仕方ない、配列型とJSON型の使い方
 
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
【SQLインジェクション対策】徳丸先生に怒られない、動的SQLの安全な組み立て方
 
O/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐO/Rマッパーによるトラブルを未然に防ぐ
O/Rマッパーによるトラブルを未然に防ぐ
 
正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?正規表現リテラルは本当に必要なのか?
正規表現リテラルは本当に必要なのか?
 
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
【公開終了】Python4PHPer - PHPユーザのためのPython入門 (Python2.5)
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!
 
PHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較するPHPとJavaScriptにおけるオブジェクト指向を比較する
PHPとJavaScriptにおけるオブジェクト指向を比較する
 
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
SQL上級者こそ知って欲しい、なぜO/Rマッパーが重要か?
 
Fantastic DSL in Python
Fantastic DSL in PythonFantastic DSL in Python
Fantastic DSL in Python
 
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
What is wrong on Test::More? / Test::Moreが抱える問題点とその解決策
 
PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門PHP5.5新機能「ジェネレータ」初心者入門
PHP5.5新機能「ジェネレータ」初心者入門
 
Pretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/MercurialPretty Good Branch Strategy for Git/Mercurial
Pretty Good Branch Strategy for Git/Mercurial
 
文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた文字列結合のベンチマークをいろんな処理系でやってみた
文字列結合のベンチマークをいろんな処理系でやってみた
 
I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"I have something to say about the buzz word "From Java to Ruby"
I have something to say about the buzz word "From Java to Ruby"
 
Cより速いRubyプログラム
Cより速いRubyプログラムCより速いRubyプログラム
Cより速いRubyプログラム
 
Javaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジンJavaより速いLL用テンプレートエンジン
Javaより速いLL用テンプレートエンジン
 
Underlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R MapperUnderlaying Technology of Modern O/R Mapper
Underlaying Technology of Modern O/R Mapper
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Oktest - a new style testing library for Python -

  • 1. PyCon JP 2011 LT Oktest a new style testing library for Python makoto kuwata http://www.kuwata-lab.com/ copyright(c) 2011 kuwata-lab.com all rights reserved. 1
  • 2. unittest (python) copyright(c) 2011 kuwata-lab.com all rights reserved. 2
  • 3. Too long! Hard to read & write! ! ! copyright(c) 2011 kuwata-lab.com all rights reserved. 3
  • 4. Test::More (perl) copyright(c) 2011 kuwata-lab.com all rights reserved. 4
  • 5. Easy to read & write! Kool! copyright(c) 2011 kuwata-lab.com all rights reserved. 5
  • 6. Oktest (python) copyright(c) 2011 kuwata-lab.com all rights reserved. 6
  • 7. So Kooooooool! copyright(c) 2011 kuwata-lab.com all rights reserved. 7
  • 8. Kool Python! Not kool. It's Java. Python Java copyright(c) 2011 kuwata-lab.com all rights reserved. 8
  • 9. ok() returns AssertionObject ok() AssertionObject Overrides '==' operator '==' copyright(c) 2011 kuwata-lab.com all rights reserved. 9
  • 10. Shows unified diff when '==' is failed. '==' uniifed diff (2.6 !) copyright(c) 2011 kuwata-lab.com all rights reserved. 10
  • 11. Test Code When Failed (no message) (no message) Shows actual & expected values copyright(c) 2011 kuwata-lab.com all rights reserved. 11
  • 12. unittest (python) copyright(c) 2011 kuwata-lab.com all rights reserved. 12
  • 13. You must describe in [a-zA-Z0-9_]+ ( ) _ Duplicated. Not DRY! DRY copyright(c) 2011 kuwata-lab.com all rights reserved. 13
  • 14. Oktest (python) copyright(c) 2011 kuwata-lab.com all rights reserved. 14
  • 15. Free text instead of method name! ! copyright(c) 2011 kuwata-lab.com all rights reserved. 15
  • 16. Any symbol or CJK available! copyright(c) 2011 kuwata-lab.com all rights reserved. 16
  • 17. internal Set free text as method name, keeping with unittest compatibility unittest copyright(c) 2011 kuwata-lab.com all rights reserved. 17
  • 18. Fixture Injection in Oktest copyright(c) 2011 kuwata-lab.com all rights reserved. 18
  • 19. All test methods call the same 'setUp()'. Coarse-grained. Want to call different initializer for each test method. setUp() copyright(c) 2011 kuwata-lab.com all rights reserved. 19
  • 20. Calls provide_member() only Calls provide_team() only copyright(c) 2011 kuwata-lab.com all rights reserved. 20
  • 21. - 'A' depends on 'B' and 'C' - 'C' depends on 'D' A B C C D Dependencies are resolved automatically Oktest copyright(c) 2011 kuwata-lab.com all rights reserved. 21
  • 22. Equivarent to setUp() provide_xxx() setUp() Equivarent to tearDown() release_xxx() tearDown() copyright(c) 2011 kuwata-lab.com all rights reserved. 22
  • 24. Oktest Python Google Search copyright(c) 2011 kuwata-lab.com all rights reserved. 24
  • 25. one more thing... copyright(c) 2011 kuwata-lab.com all rights reserved. 25
  • 26. Oktest for Node.js copyright(c) 2011 kuwata-lab.com all rights reserved. 26
  • 27. thank you copyright(c) 2011 kuwata-lab.com all rights reserved. 27