ããªãã®å€ãã¯ã FitNesseã®ãããªããšãèââããããšããããšæããŸãã ããã¯ããã¹ããwikiããŒã¯ã¢ãããšããŠäœæããïŒã€ãŸããåãã¹ããWebããŒãžã§ããïŒãç¹å®ã®ãã¯ãããžãŒïŒJavaã.NetãPowerShellãªã©ïŒã§å®è¡ããããã¹ããã¯ãããžãŒã®1ã€ã§ãã
ãã®èšäºã§ã¯ã FitNesseã䜿çšããŠ.Netã¢ããªã±ãŒã·ã§ã³ããã¹ãããäŸã«ã€ããŠèª¬æããŸãã ãããŠåæã«ãéçºæéãççž®ããããã®ããã€ãã®ããªãã¯ãšããªãã¯ã玹ä»ããŸãã ãšããã§ããããã®æè¡ã¯ãã¹ãŠå®å šã«ç¡æã§ãã
ããã¯ã©ã®ããã«èŠããŸãã
åè¿°ããããã«ãFitNeseeã®ãã¹ãŠã®ãã¹ãã¯WebããŒãžã®ããã«èŠããŸãã ãã¹ãå šäœã¯ãåããŒãã«ã«1ã€ã®é¢æ°ãå«ãŸããäžé£ã®ããŒãã«ãšããŠè¡šãããšãã§ããŸãã ããããããã¯çè«ã§ãããå®éã«ã¯ãé¢æ°åŒã³åºãã¯æ¬¡ã®ããã«ãªããŸãã
ãšããŠãã°ã€ã³ | äžéšã®ãŠãŒã¶ãŒ |
Khabrovã®ã¿ãã¬ããã¯äŒžã³ãŠããããã«èŠããããšãããã«èª¬æããŸãã å®éãFitNesseã¯ããããæå°ãµã€ãºã«å§çž®ããŸã-http://fitnesse.org/FitNesse.UserGuide.TwoMinuteExampleãåç §ããŠãã ãã ã
ãã®ãã¬ãŒãã«ã¯ããloginAsãã¡ãœãããžã®åŒã³åºããå«ãŸããŠããããSome Userãå ¥åãåãåããŸãã ã€ãŸããããã°ã©ããŒã¯loginAsé¢æ°ãå®è£ ãããã¹ã¿ãŒã¯ããã䜿çšã§ããŸãã ãã§ã«ç解ããŠããããã«ãé¢æ°ã®ååã¯å€ªåã®çµã¿åããã§ãã ãã©ã¡ãŒã¿ã¯ãã¬ãŒã³ããã¹ãã§ãã åã»ã«ã«ã¯1ã€ã®ãã©ã¡ãŒã¿ãŒã®ã¿ãå«ãŸããŸãã åã»ã«ã«ã¯ã倪åããã¹ããŸãã¯ãã¬ãŒã³ããã¹ããå«ãŸããŠããŸãã
ãŠãŒã¶ãŒã®ãã°ã€ã³å±¥æŽ | äžéšã®ãŠãŒã¶ãŒ | 㯠|
ã〠| IP | |
2014/05/07 | 192.168.0.1 | |
2014幎7æ6æ¥ | 192.168.0.1 |
ãã®å ŽåãLoginHistoryOfUserIsé¢æ°ã¯æ¢ã«Some UseråŒæ°ã§èµ·åãããŠããŸãã åºåã«ã¯ãªããžã§ã¯ãã®ã³ã¬ã¯ã·ã§ã³ãå¿ èŠã§ãããåãªããžã§ã¯ãã«ã¯Whenããããã£ãšIPããããã£ããããŸãã
ãŸã£ããåãæ¹æ³ã§ããªããžã§ã¯ãã®ã»ãããå ¥åã«é©çšã§ããŸãïŒããšãã°ãèšå®-ããŒãšå€ã®ãã¢ãæã€ãã®ãã¬ãŒãïŒã
åèšãããšãåãã¹ãã¯äžé£ã®é¡äŒŒããããŒãã«ã§ãã ããã°ã©ãã¯é¢æ°ãäœæãããã¹ã¿ãŒã¯åœŒãã®å©ããåããŠãã¹ãã¹ã¯ãªãããäœæããŸãã åœç¶ãã³ãŒãã®å ±ééšåã¯åå¥ã®ãã¡ã€ã«ã«åå²ã§ãããã³ãã¬ãŒãããµããŒããããåãã¹ãã®åã«å®è¡ãããããã¯ãå®çŸ©ã§ããŸããåºæ¬æ©èœã¯ãã¢ããªã±ãŒã·ã§ã³ïŒå°ãªããšãããžãã¹ããžãã¯ãUIãšã¯å¥ã«ïŒ ïŒ
å®è¡æ¹æ³
åè¿°ããããã«ãFitNesseã¯ããŸããŸãªãã¯ãããžãŒãšããã°ã©ãã³ã°èšèªã§æ©èœãå®è¡ã§ããŸãã 次ã®ããã«ãªããŸãã
- FitNesseã¯wikiããŒã¯ã¢ããã解æããèµ·åããå¿ èŠããããã®ïŒã©ã®WebããŒãžïŒã決å®ããŸã
- FitNesseã¯ãéžæãããã©ã³ããŒãå¿ èŠãªããã°ã©ãã³ã°èšèªã§èµ·åããèµ·åããå 容ãšæ¹æ³ãäŒããŸãã ããã«ãããã¹ãã®ã¿ãéä¿¡ãããããã«ã¯ãªããžã§ã¯ãã¯ãããŸãã
- ã©ã³ããŒã¯æ¢ã«ã©ã®ã¯ã©ã¹ã§åäœããããç¥ã£ãŠããŸãã ãã¬ãŒãã解æããé¢æ°ãåŒã³åºããŸã
ãã®èšäºã§ã¯ã.Netãã©ãããã©ãŒã ã§ã®äœæ¥ã«ã€ããŠèª¬æããŸãããããã£ãŠããã¹ãŠã®ã¯ã©ã¹ãšé¢æ°ã¯ãã®äžçã®ãã®ã§ãã Runnerãå®çŸ©ããã«ã¯ããŸã次ã®è¡ãèšè¿°ããå¿ èŠããããŸãã
ïŒCOMMAND_PATTERN {ïŒ mïŒ p}ãå®çŸ©ããŸã
ïŒTEST_RUNNERãå®çŸ©ãã{.. \ binary \ currentBuild \ NetRunner.Executable.exe}
ïŒpath .. \ binary \ testBuild \ NetRunner.InternalTests.dll
æåã¯ã©ã³ããŒãæããŸãïŒ ãã®ã©ã³ããŒã¯äŸã§äœ¿çšãããŠããŸã ïŒã FitNesseãã©ã³ããŒãå®è¡ããæ¹æ³ãå®çŸ©ããŸãã ãããã®åŒæ°+ã·ã¹ãã å€æ°ã¯ãã¹ãŠå ¥åã«æž¡ãããŸããããããã¯ãã§ã«è©³çŽ°ã§ãã
2è¡ç®ã¯ãã©ã³ããŒãžã®ãã¹ã§ãã
3è¡ç®ã¯ãAPIãå«ãDLLãžã®ãã¹ã§ãïŒè€æ°ããå ŽåããããŸãïŒïŒã ãã¹ãŠãã·ã³ãã«ã§ãã
次ã«ã å¥ã®ã©ã³ããŒã®äŸã瀺ããŸãã
ïŒTEST_RUNNER {$ {working_directory} Lib \ fitsharp \ Runner.exe}ãå®çŸ©ããŸã
ïŒCOMMAND_PATTERN {ïŒ m -a $ {working_directory} \ MyTests.dll.config -r fitnesse.fitserver.FitServerã$ {working_directory} Lib \ fitsharp \ fit.dll -vïŒ p}ãå®çŸ©ããŸã
ïŒãã¹$ {working_directory} MyTests.dll
ã芧ã®ãšãããããã§å€æ°$ {working_directory}ãæ¢ã«å®çŸ©ããŠããŸãã ããã«ããã®å€ã«å¿ããŠãç°ãªããã©ã«ããŒã®ã©ã³ããŒãèµ·åãããæãéèŠãªããšã«ã¯ããã¹ããç°ãªããã©ã«ããŒã«ãããŸãã ãã®ãããªæ§é ã¯ãå€ãã®å Žåããã«ããšãã¹ããæ©èœããè€æ°ã®ãã©ã³ãããããã«ããã©ãããã©ãŒã ã§éåžžã«åœ¹ç«ã¡ãŸãã
ãããã£ãŠããã®ã·ã¹ãã å šäœãæ©èœãããã«ã¯ïŒ
1. FitNesseãããŠã³ããŒãããŠå®è¡ããŸã
2.ã©ã³ããŒã®1ã€ãããŠã³ããŒãããŸã
3.ã©ã³ããŒã®ã©ã€ãã©ãªãåç §ããæå°éã®APIãå®è£ ããç¬èªã®ã©ã€ãã©ãªãäœæããŸã
4.ã©ã€ãã©ãªã®é¢æ°ãåŒã³åºããã¹ããäœæããŸã
5.å®è¡ãã
ãã¹ãŠããã®åŸãå°ãªããšãäœããè¡ãå°ããªãã¹ããæ¢ã«ãããŸãã 次ã«ãAPIã®å質ãæ¹åãããã¹ãã®æ°ãå¢ãããŠããã«ãããã»ã¹äžã«ãã¹ããå®è¡ããããšã§ãã
ãã¹ãAPIãäœæããæ¹æ³ã¯ïŒ
äžèšã®ããã«ãAPIã䜿çšãããã¹ãã®äœæã¯éåžžã«ç°¡åã§ããé¢æ°ãåŒã³åºããå€ãæ¯èŒããããžãã¹ã¹ã¯ãªãããäœæããã ãã§ãã åœç¶ããã®ããã«ã¯ãããžãã¹ã¢ã¯ã·ã§ã³ã®ããšãã¥ã¬ãŒã·ã§ã³ããè¡ãããããã«ãèµ·åããããã®æ©èœãå®æ§çã«äœæããå¿ èŠããããŸãã å®éãçµ±åãã¹ãã¯24æé幎äžç¡äŒã§åäœããããŠã¹ãéåžžã«ãã°ããã¯ãªãã¯ã§ããéåžžã®ãã¹ã¿ãŒã§ãã
ãããããã¹ãAPIã®äœæã«ã¯ç¬èªã®åé¡ããããŸãã ç§ã®äŸã§ã¯ã ãã®Runnerãæãäžè¬çã§ããããã ãã®Runnerã䜿çšããŸãïŒFitNesse Webãµã€ãã§ãèšåãããŠããŸãïŒã
ãŸãããã®fitSharpã®ä»çµã¿ãç解ããå¿ èŠããããŸãã ãããŠåœŒã¯æ¬¡ã®ããšãããŸãïŒ
- å®è¡ããDLLã®ãªã¹ããå®çŸ©ããŸã
- 䜿çšããæ§æãã¡ã€ã«ãå®çŸ©ããŸãã
- ãã¹ãçšã®æ°ããã¢ããªã±ãŒã·ã§ã³ãã¡ã€ã³ãäœæããŸã
- FitNesseãèŠæ±ããæ©èœãé 次起åããŸã
ãŸããå®è¡ãããããã®åãé¢æ°ãå«ãã¯ã©ã¹ãäœæããå¿ èŠããããŸãã ãããè¡ãã«ã¯ïŒ
- ãããžã§ã¯ããäœæãã
- ãã®NuGetããã±ãŒãžãè¿œå
- DoFixtureãç¶æ¿ããã¯ã©ã¹ãäœæããŸãã ã¯ã©ã¹ã«ååãä»ããŸãïŒäŸïŒMyTestFixtureïŒ
- public void MyTestïŒïŒã®ãããªã¡ãœãããäœæããŸã
- FitNesseãéããŸãïŒæ¢ã«ã³ããŒããŠå®è¡ããŠããããšãæã¿ãŸãïŒ
- æ°ãããã¹ããäœæããŸã
- TEST_RUNNERãCOMMAND_PATTERNãããã³ïŒãã¹ã倧ãŸãã«èª¬æãããšããã«å®çŸ©ããŸãã 絶察ãã¹ãæé©ã«äœ¿çšããŠãéå§ããããããŸãã
- ã»ã«ã1ã€ã ãã®ããŒãã«ãè¿œå ããŸã-[åå空é] .MyTestFixtureã Wikiããã¹ãã¯æ¬¡ã®ããã«ãªããŸã| ''ïŒ-[ã¯ã©ã¹MyTestFixtureã®åå空é] .MyTestFixture-ïŒ '' |ã ããã¯åºæ¬çã«ã¯ã©ã¹ã®ãã«ããŒã ã§ãã
- 1ã€ã®ã»ã«ãæã€ããŒãã«ãè¿œå ããŸã-MyTestïŒ| '' 'ç§ã®ãã¹ã' '' | ïŒãšããã§ã倧æåãšå°æåã¯éèŠã§ã¯ãããŸããïŒ
- ãã¹ããå®è¡ãã
æ¬ é¥ããªããã°ããã¹ããéå§ãããŸãã ããã§ãç§ãã¡ã¯äœãããŸãããïŒ
- ã¯ã©ã¹ãäœæããéæ³ã å®éãæåã¯fitSharpã¯DoFixtureããç¶æ¿ããã¯ã©ã¹ã®ã¿ãæ€åºããŸãã 次ã«ãããããäœæããé¢æ°ãå®è¡ããŸãã ã¯ã©ã¹ã¯å éšã«ããããšãã§ããŸãã
- FitNesseã«äœãã©ãã§éå§ãããã«ã€ããŠã®èª¬æã
- ããã©ã«ãã§ãã£ã¯ã¹ãã£ã䜿çšããããžãã¯ã å®éãfitSharpã«ã¯ã¹ã¿ã€ã«é¢æ°ãå¿ èŠã§ã| ã¯ã©ã¹å| é¢æ°å+åŒæ°|ã ã»ãšãã©ã®å Žåããã¹ãŠã®é¢æ°ã¯1ã€ã®ã¯ã©ã¹ã«ç©ã¿éããããŸãã æ¯åæåã«æžããªãããã«ããããã«ãäžããäžåºŠå®çŸ©ã§ããŸãã æ®å¿µãªããããªãŒããŒã©ã€ãã¯åžžã«å¯èœãšã¯éããŸããïŒããã¯ãã°ã§ãããšããæèŠããããŸãïŒã ãããŠãããã€ãã決å®ã§ããŸããã
- ãã¹ãæ©èœãå®è¡ããŸãã ããã«ããããã¹ãŠãéåžžã«ã·ã³ãã«ã«ãªããŸãããæ©èœãšã¯äœãã圌ãã¯ãããèµ·åããŸããã
ã·ã³ãã«ãªããã¹ãã§ãå€ããå°ãªããæ確ã é£ãããã®ã«ç§»ããŸãããã
è€éãªãã©ã¡ãŒã¿ãŒ
LoginAsé¢æ°ïŒæååuserLoginïŒãæ€èšããŠãã ããã æå³ã®é¢ã§äœããã¹ããã¯å€ããå°ãªããæ確ã§ã-ããã¯ç¹å®ã®ã·ã¹ãã ã®äžéšã§ãªããã°ãªããããã¹ãç°å¢ã¯ãã®ãŠãŒã¶ãŒããã®ããã«åäœããã¯ãã§ãã ãã¹ãŠãè«ççã§ãã ããããã©ã®ãã©ã¡ãŒã¿ãŒãå ¥åã«æž¡ãå¿ èŠããããŸããïŒ ãªãã·ã§ã³1-è¡ãæž¡ãã ãã§ããããå解ããŸãã ãã°ã€ã³ãšãã°ã€ã³å±¥æŽã®ååŸã®2ã€ã®æ©èœãããå Žåã解ææé ãªã©ãç¹°ãè¿ãå¿ èŠããããããããŸã䟿å©ã§ã¯ãããŸããã
ããã¯ææžåãããŠããŸããããå®éã«ã¯éåžžã«ç°¡åãªè§£æ±ºçããããŸããå ¥åãšããŠã¯ã©ã¹ãåãå ¥ããå Žåã¯ããããªãã¯éçã¡ãœããParseïŒstring argïŒãå¿ èŠã§ãã ããã¯åœç¶ãã¯ã©ã¹ãè¿ããŸãã ããšãã°ãInt32ã¯å®çŸ©ã«å®å šã«é©åããŸãïŒæ§é äœã®å Žåããããæ©èœããŸãïŒã ãã®ã¹ããŒã ã䜿çšãããšãé©åãªè²¬ä»»åæ ãåŸãããŸãããã¹ãã¡ãœããã¯ããã§ã«åŠçãããŠããããŒã¿ã®å€ããå°ãªããã§åäœããŸãã ãŸãã解æäžã®ãã¹ãŠã®äŸå€ã¯åŒãç¶ããŠãŒã¶ãŒã«è¡šç€ºãããŸãã
ã³ã¬ã¯ã·ã§ã³ãè¿ãã¡ãœãããšã®çµ¶å¯Ÿçãªé¡äŒŒæ§ãçºçããŸãïŒäžèšãåç §ïŒã ãããã¯ãã¬ãŒãã䜿çšããŠãã§ãã¯ãããŸããã€ãŸãããã¹ã¿ãŒã¯å ¥åãšããŠäºæ³ãããããŒã¿ãæäŸããé¢æ°ã¯æ£ããã³ã¬ã¯ã·ã§ã³ãè¿ãå¿ èŠããããŸãã ãã®å Žåããã¹ãŠã®ãã£ãŒã«ãã解æã§ããã¯ã©ã¹ïŒã€ãŸãããã¹ãŠã®åã«Parseã¡ãœãããããïŒãè¿ããšãæååæ¯èŒã§ã¯ãªãããªããžã§ã¯ãã®æ¯èŒãè¿ãããŸãã ãã§ã«å®å šã«å¶åŸ¡ãããŠããŸãã
ãšã³ããªãŒãã¬ãŒã
å€ãã®å ŽåãããŒãã«ã䜿çšããŠã·ã¹ãã ã«ããŒã¿ãè¿œå ãããšäŸ¿å©ã§ãã æšæºçãªäŸã¯ãä»»æã®ãããã³ã°ã§ãïŒããšãã°ãèšå®ã¯MapïŒname-> valueïŒã ã€ãŸããå®éã«ã¯ãããŒãã«ãšããã€ãã®åãå ¥åã«è»¢éãããŸãã ããã¯ãfitSharpã§ãå®è¡ã§ããŸãã ãããè¡ãã«ã¯ã次ã®ãããªã¡ãœãããäœæããå¿ èŠããããŸãã
ãããªãã¯SetUpFixture SetSettingsForUserAsïŒãŠãŒã¶ãŒãŠãŒã¶ãŒïŒã ã¡ãœããåãšåŒæ°ã¯ä»»æã§ãããæ»ãå€ã¯æ£ç¢ºã«SetUpFixtureã§ãã
次ã«ãã¯ã©ã¹ãå®è£ ããŸã-
internal sealed class MySettings : SetUpFixture { private readonly User user; public MySettings(User user) { this.user = user; } public NameValue(string parameterName, string parameterValue) { } }
æçµçã«ãããŒãã«ã¯æ¬¡ã®ããã«ãªããŸãã
ãŠãŒã¶ãŒã®èšå®ãè¡ã | ããã©ãŠã¶ãŒ | ãšã㊠|
ãåå | äŸ¡å€ | |
å | ãžã§ã³ | |
å§ | ã㊠|
åã®ãããã³ã°ãã©ã®ããã«çºçãããã¯ãå€ããå°ãªããæããã§ãã ãããŠãåŒæ°ã¯ãã®ãããªã©ãã«ã®åœ¢ã§æäŸãããããã«ãªããŸããã
ãªãŒãã¹ã¿ãŒã
ããã§ããã¹ããäœæãããŸããã ãŸãã¯ãã¹ãã¹ã€ãŒã-ãã¹ãã¹ã€ãŒãã ãããŠã圌ãã¯FitNesseã§çšŒãã ã ä»ããããããã®èªåèµ·åãéå§ãããšãã§ãã
éå§ããã«ã¯ãäž»ã«2ã€ã®æ¹æ³ããããŸãã
- æ®ãã®ãªã¯ãšã¹ãã䜿çšããŠããã¹ããå®è¡ããxmlãããŠã³ããŒãããŸãïŒããšãã°ã
httpïŒ// myServerïŒ8080 / MyTestsïŒsuiteïŒformat = xml
ïŒ çµæã¯ãå®è¡ãããå 容ãæ©èœãæéãçµæãªã©ã«é¢ããæ å ±ãå«ãxmlãã¡ã€ã«ã«ãªããŸãã - å®è¡ããã³ã¯ããŒãºã¢ãŒãã§FitNesseã®å¥ã®ã³ããŒãå®è¡ããŸãïŒjava.exe -jar "fitnesse-standalone.jar" -d DïŒ\ -c "MyTestsïŒSuiteïŒformat = xml" -b "dïŒ\ builds \ TestsResults.xml ãã ãã®å ŽåãFitNesseãèµ·åããããèªäœã§æ®ãã®èŠæ±ãå®è¡ããåçåŸãéããŸãã
2çªç®ã®æ¹æ³ã¯åžžã«æ©èœããŸããã€ãŸããFitNesseãå®è¡ããå¿ èŠã¯ãããŸãããããã«ãFitNesseãæ©èœããç¶ãããšåæã«ããã®æ¹æ³ã§ãã¹ããå®è¡ã§ããŸãã ãã¹ãŠã®çµæãäž¡æ¹ã®FitNesseã«è¡šç€ºãããŸãã
ãŸãšã
ãã®çµæããã®èšäºã§ã¯ãFitNesseçµ±åãã¹ããäœæããŠå®è¡ããæ¹æ³ããã°ããç°¡åã«èª¬æããŠã¿ãŸããã ã»ãšãã©ã®å Žåã圌ãã¯è©Šè¡é¯èª€ã«ãã£ãŠãããã®æé ãå®è¡ããŸããã1幎åã«ãã®èšäºãããã°ã確ãã«æ°æ¥ã¯ç¯çŽã§ããã§ãããã 圌女ãããªããå©ããããšãé¡ã£ãŠããŸãã