以ä¸ã®ã¤ãã³ãã®æå½±è³æã§ãã https://confengine.com/conferences/scrum-fest-osaka-2021/proposal/15337 ãåãåãã㯠https://twitter.com/nihonbuson ã¾ã§ã ãçºè¡¨è³æä¸ã®URLã Pâ¦
以ä¸ã®ã¤ãã³ãã®æå½±è³æã§ãã https://confengine.com/conferences/scrum-fest-osaka-2021/proposal/15337 ãåãåãã㯠https://twitter.com/nihonbuson ã¾ã§ã ãçºè¡¨è³æä¸ã®URLã Pâ¦
Moqã¨ã¯ï¼ .NETç°å¢ã®åä½ãã¹ãã§ä½¿ç¨ãããå¤é¨ã¢ã¸ã¥ã¼ã«ã®Mockå(Stubå)ããã±ã¼ã¸ã§ãã ä¾ãã°ããã¹ã対象ã®ã¯ã©ã¹ãHTTPãã·ãªã¢ã«ãã¼ãã§å¤é¨ã¨éä¿¡ãã¦ããã¨ããã®ã¾ã¾ã§ã¯åä½ãã¹ããçµãã®ã¯å®¹æã§ã¯ããã¾ããã(ãã¹ãç¨ã®ãµã¼ãã¼ãç¨æãããªã©ï¼ ãããã£ããHTTPéä¿¡ãã·ãªã¢ã«ãã¼ãéä¿¡ãããé¨åãããã¼ã®ãã¹ãç¨ã¢ã¸ã¥ã¼ã«ã«ç½®ãæããã®ãMoqã§ãã ç°å¢ Windows 10 Pro 2014 Visual Studio 2019 Version 16.6.3 è¨èªï¼C# (.NET Framework 4.7.2) åä½ãã¹ã ããã¸ã§ã¯ã (.NET Framework) Moq 4.14.5 (NuGetããã¤ã³ã¹ãã¼ã«) ãã¹ã対象ã¯ã©ã¹ ãã¹ã対象ã¯ã©ã¹ããå é¨ã§ã·ãªã¢ã«ãã¼ãã§éä¿¡ããã¯ã©ã¹ã¨ãã¾ãã ååã¯ãCommunication ã¨ãã¦
C# ã®ãã¹ãå®è£ 㧠Moq ã使ã£ãã®ã§ã¡ã¢ã ç°å¢ Visual Studio 2019 ã®ããã¸ã§ã¯ããã³ãã¬ã¼ã (NUnit ãã¹ãããã¸ã§ã¯ã (.NET Core)) ãä½¿ç¨ NuGet ããã±ã¼ã¸ãã Moq ãã¤ã³ã¹ãã¼ã« ãã¹ã対象ã®ã¯ã©ã¹å®è£ ããã¾ã§ç¨ä¾ã®ããã®å®è£ ã§ããã Moq ãæ´»ãããã¹ã対象ã§ã¯ãªãã public class Human { /// <summary> /// èå /// </summary> private string FamilyName { get; } /// <summary> /// åå /// </summary> private string GivenName { get; } /// <summary> /// å¹´é½¢ /// </summary> public virtual int Age { get; } p
ã¯ããã« ã¢ãã«ã¬ã®14æ¥ç®ã«ç´¹ä»ããè¨äºã®ç¶ç·¨çãªè¨äºã«ãªãã¾ãã ä»å㯠F# + VSCode ç°å¢ã§ã¦ããããã¹ããå®æ½ããæ¹æ³ãç´¹ä»ãããã¨æãã¾ãã ãããã¾ã VSCode ã« F# ã®éçºç°å¢ãå°å ¥ãã¦ããªãæ¹ã¯ããã² ãã¡ã ã®è¨äºãåèã«å°å ¥ãã¦ã¿ã¦ãã ããï¼ éçº ããã§ã¯å®éã«ããã¹ãå®æ½ã¾ã§ã®æµãã追ã£ã¦ããããã¨æãã¾ãã ä»åã®è¨äºã Powershell ãå©ç¨ãã¦è§£èª¬ãé²ãããã¦ããã ãã¾ãã ã½ãªã¥ã¼ã·ã§ã³ã®ä½æ ã¾ãã¯ã½ãªã¥ã¼ã·ã§ã³ãä½æãã¦ããã¾ãã 以ä¸ã®ã³ãã³ããå®è¡ãããã¨ã§ãXunitPractice ã¨ãããã£ã¬ã¯ããªã®ä¸ã« XunitPractice.sln ã¨ããã½ãªã¥ã¼ã·ã§ã³ãã¡ã¤ã«ãä½æããã¾ãã
ããã«ã¡ã¯ï¼ ãªã¯ã«ã¼ããã¯ããã¸ã¼ãºã§ã»ãã¥ãªãã£ã¨ã³ã¸ãã¢ã¨ãã¦æ´»åãã¦ãããè¤å å·§ã§ãã æ¯å¹´æä¾ã¨ãªã£ã¦ããã大ããªåé¿ãããã ãã¦ãããã¨ã³ã¸ãã¢ã³ã¼ã¹ã®æ°äººç ä¿®ã®å 容ãç´¹ä»ããã¦ããã ãã¾ãã ç ä¿®ã®æ¦è¦ ãªã¯ã«ã¼ããã¯ããã¸ã¼ãºã§ã¯ãæ°åæ¡ç¨ã®æ°äººåãã«ï¼ã¶æéã®æè¡ç ä¿®ãè¡ã£ã¦ãã¾ãããã®æè¡ç ä¿®ã§ã¯å¤§ããåãã¦ï¼ã¤ã®ã³ã¼ã¹ãè¨ãããã¦ãã¾ãã 1. ããã°ã©ãã³ã°ãWebãµã¼ãã¹ã®æ§é ã®åºç¤ãä½ç³»çã«å¦ã³ããã®å¾ä¸äººã«ã¤ããã²ã¨ã¤ã®ã¹ãããµã¤ããä¼ç»ãããªãªã¼ã¹ã¾ã§è¡ãã³ã¼ã¹ 2. ä¸å®ä»¥ä¸ã®ããã°ã©ãã³ã°ã¹ãã«ã¨éçºç³»çµé¨ãããæ°äººã«åãããå®éã®éçºã§å¿ è¦ã¨ãªãæ§ã ãªæè¡è¦ç´ ãããæ·±ãå¦ã³ããã®å¾å®éã®ãµã¼ãã¹ã§ãã¼ã éçºã«ã¦OJTãè¡ãã³ã¼ã¹ ä»åå ¬éããã®ã¯ 2. ã§ä½¿ç¨ããè³æã§ãã ãã®æè¡ç ä¿®ã¯ããã®ã»ã¨ãã©ã®é¨åãå 製ã§å®æ½ãã¦ãã¾ãã ãã®ç ä¿®ã®æ大ã®
A cheat sheet for the XUnit test framework All source code can be found on GitHub here. This post is part of my cheat sheet series. using System; using System.Collections.Generic; using Xunit; using Xunit.Extensions; namespace GenericsExamples.Tests { public class AccountTests : IDisposable, // Allows Test TearDown via Dispose() IUseFixture<AccountTests.TestSetUpClass> // Allows Test Set Up via in
ä»MOCKãä¸å¿ã¨ãã¦ã½ã¼ã¹ã³ã¼ããè¨è¼ãã¦ããã®ã§ãã å¿ããªãããã«åºæ¬çãªé¨åãæ¸ãã¦ã¿ã¾ããã åèã«ãªããªãããããã¾ããããåå¿é²ã¨ãã¦ã åèä¾ï¼ //MoqãNUGETããDLå¾ãä¸è¨ãå®ç¾© using Moq; //å®ç¾© var mock = new Mock</*ã¤ã³ã¿ã¼ãã§ã¼ã¹*/>(); //å®ç¾©ããMockã®é¢æ°ãè¨å® //ImplementMethod //ãã¾ããããé¢æ° // IsAny Matches any value of the given TValue type mock.Setup( x=> x.ImplementMethod(It.IsAny</*å*/>())) .Returns/*éåæã®å ´åAsyncã追å */( /*æ»ãããåãobject*/); å®è£ å ¨ã¦ using Moq; namespace Verification { //å®
Moq ã¯ããã¹ãããã«ï¼ï¼åä½ãã¹ãç¨ã®ä»£å½¹ãªãã¸ã§ã¯ãï¼ãç°¡åã«ä½ãããã®ã©ã¤ãã©ãªã§ãã ãã¹ãããã« åä½ãã¹ãã«ãããåé¡ã®ã²ã¨ã¤ã¨ãã¦ã以ä¸ã®ãããªãã¨ãããã¾ãã ãã¹ã対象ã®ä¾åãªãã¸ã§ã¯ããã»ã»ã» ãããã¯ã¼ã¯éä¿¡ãå¿ è¦ ãã¼ã¿ãã¼ã¹ã¢ã¯ã»ã¹ãå¿ è¦ ãªã©ãå¤é¨ã«ä¾åããå ´åããã®ã¾ã¾ã§ã¯åä½ãã¹ããä½ãã«ããã§ãã ããã解決ããããã«ãå®éã®ãªãã¸ã§ã¯ãã®ä»£ãããç¨æãã¾ãã ãã¹ãç¨ã®ä»£å½¹ãªãã¸ã§ã¯ãããã¹ãããã«ã¨å¼ã³ã¾ãããã¹ãããã«ã¯ãã®å½¹å²ã«å¿ãã¦ãã¹ã¿ããã¢ãã¯ããã§ã¤ã¯ããªã©ã¨å¼ç§°ããã¾ãï¼ãããã®éãã«ã¤ãã¦ã¯ãæ¬è¨äºã®ä¸»é¡ã¨ç´æ¥ã¯é¢ä¿ããªãã®ã§å²æãã¾ãï¼ã å ¸åçãªãã¹ãããã«ã®å®è£ ãã¹ãããã«ã¯ããã¾ã§ä»£å½¹ãªã®ã§ãæ¬ç©ã¨åãæ¯ãèãã¯ãã¾ãããåä½ãã¹ããåãã°è¯ãã¨å²ãåãã¾ãã æ¬ç©ã¨åã I/F ãæã¤ã éä¿¡ãªã©ã®æ¯ãèãã¯ããªãã ç¹å®
ã¯ãã¹ãã©ãããã©ã¼ã ã§éçºã§ãã.NET Coreã®åºç¤ããéçºå®è·µã¾ã§ãå¦ã¹ãå ¥éé£è¼ãæçµåã¯åä½ãã¹ãç¨ã®ããã¸ã§ã¯ããä½æãã¦ããã¹ããè¡ãæ¹æ³ã説æããã â åå é£è¼ INDEX .NET Coreã¨åä½ãã¹ã .NET Coreã§å©ç¨å¯è½ãªåä½ãã¹ããã¼ã« .NET Coreã¯åä½ãã¹ãã®å®è¡ã容æã«ãªãããã«è¨è¨ããã¦ããã.NET Core CLIã§åä½ãã¹ãããã¸ã§ã¯ãã®ä½æããå®è¡ã¾ã§è¡ããããã«ãªã£ã¦ãããåä½ãã¹ããã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦ãxUnitãNUnitãMSTestããµãã¼ãããã¦ãããã¾ããè¨èªã¨ãã¦ãC#ãF#ãVisual Basicã®ãããããããã3ã¤ã®ãã¬ã¼ã ã¯ã¼ã¯ã§å©ç¨å¯è½ã ã ä»åã¯ãC#ã®ã¯ã©ã¹ã©ã¤ãã©ãªããã¸ã§ã¯ãã«ãããã3ã¤ã®ãã¬ã¼ã ã¯ã¼ã¯ãå©ç¨ããåä½ãã¹ãããã¸ã§ã¯ããä½æããªãããç°¡åãªä½¿ãæ¹ã説æãããããªããä»åã¯åãã½
ã¹ã¿ãã¨ã¢ãã¯ã®éãã¨ããã®ãæ¸ããã®ã§ãããæ¸ãã¦ããã¨ãããã¹ãããã«ãã¨ããç¨èªã«ã¤ãã¦ããç¥ããªãã¾ã¾æ¸ãã¦ãã¾ããããããã³ã¡ã³ãã§ææãããæ¹ãã¦èª¿ã¹ã¦ã¿ã¾ããã 5種é¡ã®ãã¹ãããã« ãã¹ãã¹ã¿ã å®éã®ä¾åã³ã³ãã¼ãã³ãã«ããããã¹ã対象ã«éæ¥å ¥åãè¡ããã®ããã®ãã¹ãå ã§ã¯éæ¥å ¥åã®å¤ã確å®ã§ããã RSpecã§ãã allow(hoge).to revceive(:fuga).and_return('foo') ãã¹ãã¹ã㤠ãã¹ã対象ãä»ã®ã³ã³ãã¼ãã³ãã«éæ¥åºåãè¡ãå ´åãå®éã®ã³ã³ãã¼ãã³ãã®ä»£ããã«ã¡ãã»ã¼ã¸ãåãåãè¨é²ãããã®ãã¢ãã¯ã¨ã®éãã¯äºåã«æå¾ ããå¤ãç¥ã£ã¦ãã¦ãä¸è´ãã¦ãããã©ããæ¤è¨¼ãè¡ããã©ããã RSpecã§ãã㨠expect(hoge).to have_received(:fuga) ã¢ãã¯ãªãã¸ã§ã¯ã ãã¹ã対象ãä»ã®ã³ã³ãã¼ãã³ãã«
ããã¡ãã£ã¨è¦ç´çãªãã®ããJavaã§ã®UTä½æåºæºãæ´çãã¦ã¿ããã«ãã¾ã¨ãã¦ã¿ã¾ããã ã¯ããã« å»å¹´ãããã°ã®æ¹ã«ããµã¤ãã®ã¦ããããã¹ãã®ããã®ï¼ã¤ã®ã«ã¼ã«ãã¨ããè¨äºãæ¸ããã®ã§ãããæã£ãããåé¿ãããã¾ããã ãã®è¨äºã§æ¸ããã®ã¯ããã¾ã§åçã»ååã§ããããå®ç¾ããããã«ã¯ããã¤ãã®ãã¯ããã¯ãå¿ è¦ã§ãã ç¹ã«ãããããã«ã¼ã«ãä½ã£ã¦ãã¦ããããã¹ããæ¸ãäºããå³å®ããããã«ãã¦ãã é©åãªãã¯ããã¯ãç¥ããªããã°ã¡ã³ããå°é£ã ã£ãããå質ã«å¯ä¸ããªãã£ãããå®è¡æ§è½ãæªãã´ããéç£ãããå¯è½æ§ãããã¾ãã ããããã©ãããã°è¯ããã¨ããã¨ãæåããã¦ããããã¹ããæ¸ããããããã«å ã®ã³ã¼ããè¨è¨ãããã¨ãããã¨ã§ãã ãããã¾ã身ã«ä»ããã¹ãã¯ããã¹ãã³ã¼ãã®æ¸ãæ¹ãã§ã¯ç¡ãããã¹ã対象ã³ã¼ããããªãã¡ããããã¯ãã³ã¼ãã®æ¸ãæ¹ããªã®ã§ãã ã¾ããããã§è¨ã£ã¦ããæåããã
ã¦ããããã¹ããæ¸ãã¨ãããã¹ã対象ãä½ãå¥ã®ã³ã³ãã¼ãã³ãã«ä¾åãã¦ããã¨ããã¹ããæ¸ãã«ãããã¨ãããã ä¾ãã°ããã®ä¾åãã¦ããã³ã³ãã¼ãã³ããã¾ã éçºã®éä¸ã§ç¡ãã¨ãããããã¯ç°å¸¸ç³»ãªã©ãã¹ããããç¶æ³ãä½ãã«ããã£ãããå®è¡ã«ãããæéãããããªã©ãªã©ã ãããªã¨ãã¯ãä¾åãã¦ããã³ã³ãã¼ãã³ãããã¹ãããã«ã¨å¼ã°ãã代æ¿åã§ç½®ãæãã¦ããã¨è¯ãã Python ã«ã¯ãã¼ã¸ã§ã³ 3.3 ããæ¨æºã©ã¤ãã©ãªã«ãã¹ãããã«ç¨ã®ããã±ã¼ã¸ unittest.mock ãåãè¾¼ã¾ããã 使ã£ã¦ãã Python ã®ãã¼ã¸ã§ã³ã 3.3 æªæºã®ã¨ã㯠PyPI ãã mock ãã¤ã³ã¹ãã¼ã«ããã ããã¯åºæ¬çã«ãã¼ã¸ã§ã³ 3.3 ã§å°å ¥ããã unittest.mock ã¨åããã®ã ã¾ãã¯ãã¹ããæ¸ãããã®é¡æã ãã©ããã®ããã°ã®ã¹ã¯ã¬ã¤ãã³ã°ã«ããã ãã¹ãããã«ãå¿ è¦ã«ãªãå ´é¢ã¨ã
ãã㯠Python3 Advent Calendar ã®è¨äºã§ãã夢ã¯ãã¹ãã¨ã³ã¸ãã¢ã§ãï¼ã¨ãããã¨ã§ã¦ããããã¹ãã«ã¤ãã¦æ¸ãã¾ãã Python3 ç¸ãã¨ã®ãã¨ã§ããããã®æ°ã¦ããããã¹ããã¬ã¼ã ã¯ã¼ã¯ã¯ Python 3.2 以é㨠2.7 以éã対象ã§ãããã以åã®ãã¼ã¸ã§ã³ã§ãã®æ°ã¦ããããã¹ããã¬ã¼ã ã¯ã¼ã¯ãå©ç¨ãããå ´åã¯ããããã unittest2py3k (3 ç³»)ã unittest2 (2 ç³») ã¨ããããã¯ãã¼ããç¨æããã¦ãã¾ããæ°ã¦ããããã¹ã㯠mock ã IronPython çã®éçºè ã¨ãã¦ãç¥ããã¦ãã Michael Foord æ°ãä¸å¿ã«éçºããã¾ããã >>> Python ã¨ã¦ããããã¹ãã®æ´å² Python ã®ã¦ããããã¹ãã¯ã1999 å¹´ xUnit ãã¡ããªã¼ã® PyUnit ã¨ãã¦éçºããã2001 å¹´ã«å ¬éããã Python
åã ãããPython, Django çéã®åä½ãã¹ãäºæ ãã¾ã¨ãããã¨æã£ã¦ããã®ã§ããããããªç´ æµãªã¾ã¨ãè¨äºãè¦ã¤ãã¾ããã Pythonç¨ã®ã¦ããããã¹ããã¼ã«ã¾ã¨ã | TRIVIAL TECHNOLOGIES 4 @ats ã®ã¤ã¯ã¡ã³æ¥è¨ ãã®è¨äºã§ã¯ãunittest, unittest2, doctest, py.test, nose ã®ã»ããããããèãããã¨ã®ãªããããªãã®ã¾ã§åãä¸ãã¦ããã¦ããã®ã§ãããä»åã¯ãèªåã§ä½¿ããããªç¯å²ã®ãã¹ããã¼ã«ã«ã¤ãã¦å°ããã£ã¼ãã«ã¾ã¨ãã¦ã¿ããã¨æãã¾ãã åãä¸ããã®ã¯ã以ä¸ã® 4種é¡ï¼ãDjango + unittestãã unittest ã¨ãã¦ã«ã¦ã³ããã㨠3種é¡ï¼ã®ãã¹ããã¼ã«ã§ãã ã»ãã«ããpytest ã doctest ãåãä¸ãããã£ãã®ã§ãããã¾ã 使ã£ããã¨ããªãã£ãã®ã§å²æãã¾ãï¼å¾ã§æ¸ããã¨ã«ãªãã
ãã¹ãé§åéçºå¤§å¥½ãã§ããåºæ¬çã«èªåããã¸ã§ã¯ãã«ãããéçºãããã¯ãã«ããããã¹ãé§åããã¨ãã¨ã¦ãæ°æã¡ãç©ããã«ãªãã¾ãã ããããè¯ãææããã¦ããã¨ããããã¹ãé§åã¯æ²¹æããã¨ãã¹ãèªä½ãã¡ã³ããã³ã¹ä¸å¯è½ã«ãªãã¨ããæ¬ ç¹ãããã¾ãã æããããã¹ãé§åã«ã¯ãã¹ãé§åãªãã®ã¢ã³ããã¿ã¼ã³ãããã¾ãããã®ä¸ã¤ããèªåã®ä¸ã§ç«ã¡ä½ç½®ãããããªããã®ã§ãããã«ã¡ã¢ãã¦ããã¾ãã ãã¹ãé§åã¢ã³ããã¿ã¼ã³ã»ãã¹ããã¼ã¿ããã¹ãã¹ã¤ã¼ãã§å®£è¨ãã¦ãã¾ã èªåãéå»ã«ãã¹ããã¼ã¿ã使ããããªã¼ã¨ããå ´åãåå¥ã®ãã¹ãã¹ã¤ã¼ãã§å®£è¨ãã¦ãã¾ãå ´åãããã¾ããä¾ãã°ä¸ã®ãããªå ´åã
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}