Gradle ã§ãã¹ãã並åå®è¡ãã¦ã¿ã
Gradle ã® Java ãã©ã°ã¤ã³ã«ã¯ ãã¹ãã並åã§å®è¡ããããã®æ©è½ãæ¨æºã§ç¨æããã¦ãã¾ãã
é常㯠ãã¹ãç¨ã®ããã»ã¹ã¯ 1ã¤ããç«ã¡ä¸ããã¾ãããã
test.maxParallelForks = 5ã®ããã«è¨å®ããã° æ大 ï¼ããã»ã¹ã§ä¸¦åå®è¡ã§ããããã«ãªãã¾ãã
ãã¡ãããæè¿ããæ°ã«å ¥ãã® Spock ã§ã ã¡ããã¨ä¸¦åå¦çã§ãã¾ãã
並åå¦ç㯠ã¯ã©ã¹åä½ã§è¡ããããã æéã®ããã (ããããCPUæéã®å°ãªã) ã¡ã½ãããå¤ãå ´å㯠ãªãã¡ã¯ã¿ãªã³ã°ãã¦ã¯ã©ã¹ãåããæ¹ãããã§ãã
å
é¨ã¯ã©ã¹ã§ã ãããã ã¡ããã¨ä¸¦åå¦çãã¦ãããã®ã§ããã¡ã¤ã«ã¯ãã®ã¾ã¾ã§ ã¯ã©ã¹ã ãåãããã¨ãã§ãã¾ãã
ä¾ãã°...
class HelloSpock extends spock.lang.Specification { def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("FOO"); hello.sleep(30) expect: hello.greeting() == "Hello, FOO." } def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("BAR"); hello.sleep(30) expect: hello.greeting() == "Hello, BAR." } def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("HOGE"); hello.sleep(30) expect: hello.greeting() == "Hello, HOGE." } }ã®ããã«ä¸ã¤ã®ã¯ã©ã¹ã« 30 ç§ãã¤ãããã¡ã½ãããããå ´åãããã並åå¦çããããã«è¨å®ãã¦ã ä¸ã¤ã®ããã»ã¹ã§å¦çããã®ã§ 90 ç§ãããã¾ããã
class HelloFooSpock extends spock.lang.Specification { def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("FOO"); hello.sleep(30) expect: hello.greeting() == "Hello, FOO." } } class HelloBarSpock extends spock.lang.Specification { def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("BAR"); hello.sleep(30) expect: hello.greeting() == "Hello, BAR." } } class HelloHogeSpock extends spock.lang.Specification { def "30ç§å¾ã«ç®ãè¦ãã¦æ¨æ¶ãã"() { Hello hello = new Hello("HOGE"); hello.sleep(30) expect: hello.greeting() == "Hello, HOGE." } }ã®ããã«å é¨ã¯ã©ã¹ã§åé¢ããã°ã3ããã»ã¹ã§å¦çãããã®ã§ã30 ç§ + α ã§å®è¡ã§ãã¾ãã
ãã¨ã
test.forkEvery = 3ã®ããã«è¨å®ãã㨠ä¸å®æ° ãã¹ãã¯ã©ã¹ãå®è¡ãããããã»ã¹ãåèµ·åãããã¨ãã§ãã¾ãã
ä¸è¨ã®å ´åã 㨠åãããã»ã¹ã§ 3ã¤ã® ãã¹ãã¯ã©ã¹ãå®è¡ãããåèµ·åããã¾ãã