JUnit ã¨è¨ãã° Eclipse ãªãããã使ããã¨ãå¤ããããããªããã©ã ä»åã¯ã³ãã³ãã©ã¤ã³ãã使ã£ã¦ã¿ã¾ããã 試ãããã¼ã¸ã§ã³ã¯ãç¹ã«çç±ã¯ãªããã© 3.7 㨠4.11 ( 2013/04/02 æç¹ã®ææ° ) ã§ãã 1. ãã¹ã対象ã®ã³ã¼ããä½æãã ä»åã¯ç°¡åã®ããã以ä¸ã®ããã«ååæ¼ç®ãããã®ã§ããã¾ããã 以ä¸ã®ã³ã¼ããæ¸ãã¦ãã³ã³ãã¤ã«ãã¦ããã public class Sample { public static void main(String[] args) { public int add(int a, int b) { return a + b; } public int sub(int a, int b) { return a - b; } public int mul(int a, int b) { return a * b; } public
ä»åã¯ãJUnitãã³ã³ã½ã¼ã«ãã使ãããã®ç°å¢ä½ãã«ã¤ãã¦è©¦ãã¦ã¿ã¾ãã ããã§ã¯ãJDKã¯ãã§ã«ã¤ã³ã¹ãã¼ã«ããã¦ãããã®ã¨ãã¾ãã JDKã®ã¤ã³ã¹ãã¼ã«ã«ã¤ãã¦ã¯ã以ä¸ã®ãã¼ã¸ãªã©ãåèã«ãã¦ã¿ã¦ãã ããã http://www.javadrive.jp/install/jdk/ 使ç¨ãã¦ããç°å¢ã¯ä»¥ä¸ã®éãã§ãã ã»Windows 7 SP1 ã»JDK 1.7.0 (64bit ver.) ã»JUnitã®å°å ¥ ã¾ããJUnitã®Jarãã¡ã¤ã«ãªã©ããã¦ã³ãã¼ããã¾ãã ç¾æç¹(2012/3)ã§ã®ææ°çã§ãã4.10ã¯ãgithubä¸ã«ããã¾ãã githubä¸ã«ã¯ã4.7ã¾ã§ã®JUnitããã¦ã³ãã¼ããããã¨ãã§ããããã«ãªã£ã¦ãã¾ãã https://github.com/KentBeck/junit/downloads ãããã以åã®ãã¼ã¸ã§ã³ã®ãã®ã¯sorceforgeã«ãã
ååæ稿ã®ç¶ãã§ãã ååã¯ãJenkinsã§èªåãããã¤ãã¦ã¿ããã·ã¹ãã ã¨ããã®åé¡ç¹ãèªåãªãã®è§£æ±ºæ¡ã®æ¦è¦ãæ¸ãã¾ããã ä»åã¯ã解決æ¡ã®ãã¡ããã«ãã»ãããã¤ã«é¢ããåºç¤çãªé¨åããå ·ä½çã«è¨è¿°ãã¦ã¿ããã¨æãã¾ãã ä»åã®ç®æ¨ 次ã®ãããªæµããJenkinsã§èªååãã¾ããSubversionããã½ã¼ã¹ãåå¾ãããã«ããã¦ãFTPã§ã¢ã¸ã¥ã¼ã«ãé å¸ããTomcatãåèµ·åããã ãã¤ã³ã ãã¡ã¤ã«ã®é å¸ã¯ãAntã®FTPã¿ã¹ã¯ã使ç¨ããã Tomcatã®åèµ·åã¯ãTomcatã®Antã¿ã¹ã¯ã使ãã åæ Jenkinsã¯ãéçºç°å¢ï¼Windowsï¼ã§èµ·åããã ãã¹ãç°å¢ã®Tomcatã«ã¯ãWebã¢ããªã±ã¼ã·ã§ã³ï¼å¤ãã¢ã¸ã¥ã¼ã«ç¶æ ï¼ããããã¤æ¸ã¿ã§åä½ããç°å¢ã¨ãªã£ã¦ããã ããã¸ã§ã¯ãæ§æ ãµã³ãã«ã¨ãã¦ç¨æããWebã¢ããªã±ã¼ã·ã§ã³ã®ã½ã¼ã¹ã¯ã次ã®ãããªæ§æã§ããç¹å¥ãªã
ååä½æãã JUnitã使ã£ã¦ã¿ãããµã³ãã«ã ãantããããã¯ã§ããããã«ããããã«build.xmlãä½æãã¦ã¿ã¾ããã eclipseã®All in oneã使ç¨ãã¦ããã¨antã®DTKãããã©ã«ãã§ã¤ã³ã¹ãã¼ã«ããã¦ããã®ã§ç°¡åã«build.xmlãä½æã§ããã®ã§ãä»åã¯ãã®æ¹æ³ããç´¹ä»ãããã¾ã â ããã¸ã§ã¯ããå³ã¯ãªãã¯ãã¦ã¨ã¯ã¹ãã¼ããã¯ãªã㯠â¡ã¨ã¯ã¹ãã¼ãã®ã¦ã£ã¶ã¼ãã表示ãããã®ã§ããä¸è¬ãâãAntãã«ããã¡ã¤ã«ããé¸æãã次ã¸ãæ¼ä¸ãã â¢Antãã«ããã¡ã¤ã«ã®çæã¦ã£ã¶ã¼ãã§ããã¸ã§ã¯ããé¸æããã¦ãããã¨ã確èªãããå®äºãæ¼ä¸ãã ä½æãããXMLãã¡ã¤ã«ãè¨è¼ãã¦ããã¾ãã <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!-- WARNING: Eclipse auto-generated
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}