Javaã«ãããéçºã»Testï¼Unit/Web/è² è·)ç°å¢ã®ã¾ã¨ã
ãã¡ã®æ¯è¦ªã§ãç¥ã£ã¦ããJavaã«ããããªã¼ãã³ã½ã¼ã¹ãæ´»ç¨ããéçºç°å¢ã»Testç°å¢ã«ã¤ãã¦èª¿æ»åã³è©ä¾¡ããå¿
è¦ãããæå¤ã¨å´åãè¦ããã®ã§
ããããJavaã§ã®éçºã«ããã¦éçºç°å¢ã»Testç°å¢ãæ§ç¯ããéã®åèã«ãªãã°ã¨ã¡ã¢ãã¦ããã¾ãã
éçºç°å¢ããã«ããã¼ã«ãTestãWeb Testingãè² è·ãã¹ãã«éç¹ãç½®ãã¦ããã¾ãã
ã¤ã³ã¹ãã¼ã«ããã«ä½¿ç¨åºæ¥ãIDEã®tIDEããjythonã§Webãã¹ããè¨è¿°ããMaxQãããã©ã¼ãã³ã¹ãã¹ããjythonã§è¨è¿°ããGrinder3ã
Flexã®è² è·ãã¹ããå¯è½ãªWebLOADãSwingã®ãã¹ãç¨ã®UISpec4jçãæ°ããçºè¦ããã£ãã®ã§Javaéçºè
ã®äººã«ãåèã«ãªãã¨å¬ããã§ãã
ããããã©ã¤ã»ã³ã¹ãææ°ãã¼ã¸ã§ã³ãå人çãªãè¦ã度(5ç¹æºç¹)ãåããã¦æè¨ãã¦ããã¾ãã
IDE
name | URL | Ver. | Licence | Recommend |
---|---|---|---|---|
Eclipse | http://www.eclipse.org/ | 3.4.1 | EPL | |
NetBeans | http://www.netbeans.org/ | 6.5 | CDDL/GPLV2 | |
EasyEclipse | http://www.easyeclipse.org/site/home/ | 1.3.1.1 | GPL | |
tIDE | http://snowmail.sn.funpic.de/tide/ | ? | GPL | |
jEdit | http://www.jedit.org/ | 4.3pre16 | GPL2.0 |
tIDE
tIDEã¯ã¤ã³ã¹ãã¼ã«ããã«ãªã³ã©ã¤ã³ã§ä½¿ç¨å¯è½ãªIDEã§ãJNLPãã¡ã¤ã«ãJWSã§å®è¡ãIDEã試ããã®ã§è©¦ãã¦ã¿ãã¨ãªããªããããããã§ãã
ãã¡ãããtIDEã®åä½ç¢ºèªåºæ¥ã¾ãã
ãã®çºæ³ã¯ãªããªãè¯ãã¨æãã¾ããã¤ã³ã¹ãã¼ã«ãjarãã¡ã¤ã«1ã¤ãªã®ã§ä»¥ä¸ã§å®è¡å¯è½ã
java -jar tide.jar
Build Tool
name | URL | Ver. | Licence | Recommend |
---|---|---|---|---|
Ant | http://ant.apache.org/ | 1.7.1 | ASL 2.0 | |
Maven | http://maven.apache.org/ | 2.0.9 | ASL 2.0 | |
Ivy | http://ant.apache.org/ivy/ | 2.0.0 | ASL 2.0 | |
Gant | http://gant.codehaus.org/ | 1.6.0 | ASL 2.0 |
ãã«ããã¼ã«ã¾ã¨ã
Ivyã¯ãã«ããã¼ã«ã¨ãããããã©ã¤ãã©ãªã®ä¾åé¢ä¿ã管çãããã®ã§ãAntã使ç¨ãã¦ä¾åé¢ä¿ã®ç®¡çãè¡ãå ´åã¯Ivyãæ¡ç¨ãã¦ã¿ãã®ãè¯ãã
å人çã«ã¯ãMaven2ã«è©³ãã人ãããã°Maven2ãæ¡ç¨ãpom.xmlã®ä½æãæèè
ã«ä»»ããã®ãè¯ãã
Gantã¯Antã¿ã¹ã¯ã«ãã£ã¦ãã«ããå®è¡ãããã«ããã¼ã«ã ãããã«ããã¡ã¤ã«ãXMLå½¢å¼ã§ã¯ãªãGroovyã¹ã¯ãªããã«ãã£ã¦è¨è¿°ãããã¨ãå¯è½ã«ããã
Groovyãå¾æã§ããã°ãGantãé¸æè¢ã«å
¥ãã¦è¯ããGantã«ã¯Ivy Toolãããã
Eclipseã«åãããå梱ããã¦ããã®ã§Antã¯æ軽ã«è©¦ãããããç¾å ´ã§ã®ä½¿ç¨ã¯ä¸çªå¤ãã
Mavenã¯ãã©ã°ã¤ã³ãè±å¯ãªã¨ããã¯ããªããå§ãã ããå°ã
é£ããã¨ãããããã
Unit Test
name | URL | Ver. | Licence | Recommend |
---|---|---|---|---|
JUnit | http://www.junit.org | 4.5 | CPL | |
TestNG | http://testng.org/ | 5.8 | ASL |
TestNG è£è¶³
- TestNG Eclipse Plug-in http://testng.org/doc/eclipse.html
- TestNG IDEA Plug-in http://testng.org/doc/idea.html
- TestNG Maven Plug-in http://testng.org/doc/maven.html
- TestNG Ant Task http://testng.org/doc/ant.html
Unit Testã¾ã¨ã
JUnitãTestNGããã©ã°ã¤ã³ãè±å¯ã§ãã©ã¡ãã使ç¨ãã¦ãè¯ãã¨æããJUnitã®æ¹ãããæ
å ±éãå¤ããEclipseã«åãããå梱ããã¦ããã®ã§JUnitã¯èªç¥åº¦ãé«ãã
TestNGã¯ãåä½ãã¹ãéè¦ã¨ããããçµ±åãã¹ããé«ã¬ãã«ãªãã¹ãã«ãã´ãªã¾ã§ã«ãã¼ããããã«è¨è¨ããã¦ããæ¡ç¨ãã¦ãè¯ãã
Web Testing
name | URL | Ver. | Licence | Recommend |
---|---|---|---|---|
Selenium | http://seleniumhq.org/ | â» | ASL2.0 | |
Jamelon | http://jameleon.sourceforge.net/ | 3.3-RC1 | LGPL | |
JWebUnit | http://jwebunit.sourceforge.net/ | 2.1 | BSD | |
HttpUnit | http://www.httpunit.org/ | 1.7 | MIT | |
HtmlUnit | http://htmlunit.sourceforge.net/ | 2.4 | ASL2.0 | |
MaxQ | http://maxq.tigris.org/ | 1.0.3 | BSD | |
Canoo WebTest | http://webtest.canoo.com/ | 2.6 | ASL2.0 |
Selenium
- Selenium Remote Control http://seleniumhq.org/projects/remote-control/
- Selenium Grid http://selenium-grid.seleniumhq.org/
- CubicTest(Eclipse) http://cubictest.seleniumhq.org/
CubicTestã¯å人çã«æ³¨ç®ãã¦ãã¾ããCubicTestã«ã¤ãã¦ã¯å¥éç´¹ä»ãããã¨æãã¾ãã
Jamelon
ãã¦ã³ãã¼ããã¦è§£åããã ãã§ä½¿ããGUIãã¼ã«ã§ããæ¥æ¬èªã®æ
å ±ãå°ãªãããå§ãã
plug-inãè±å¯ã§ãã¤ä½æå¯è½ã
- JUnit plug-in http://jameleon.sourceforge.net/junit-plugin.html
- Jiffe plug-in http://jameleon.sourceforge.net/jiffie-plugin/index.html
- Selenium plug-in http://jameleon.sourceforge.net/selenium-plugin/index.html
- Watij plug-in http://jameleon.sourceforge.net/watij-plugin/index.html
- Jagacy(3270) plug-in http://jameleon.sourceforge.net/jagacy-plugin/index.html
- HtmlUnit plug-in http://jameleon.sourceforge.net/htmlunit-plugin/index.html
- HttpUnit plug-in http://jameleon.sourceforge.net/httpunit-plugin/index.html
- jWebUnit plug-in http://jameleon.sourceforge.net/jwebunit-plugin/index.html
æ´»åãããªãæ´»çºãªã®ã§ã注ç®ãã¦ããããã¨æãã¾ãã
JWebUnit example
å é¨çã«HtmlUnitã使ç¨ã
public class AppTest extends WebTestCase { public void testSample1() { setBaseUrl("http://jwebunit.sourceforge.net"); beginAt("/index.html"); assertTitleEquals("JWebUnit - JWebUnit"); } }
HttpUnit example
HTTPãªã¯ã¨ã¹ã/ã¬ã¹ãã³ã¹ã表ãObjectã使ç¨ã
public static void main(String[] args) throws Exception{ WebConversation wc = new WebConversation(); WebRequest req = new GetMethodWebRequest("http://www.httpunit.org/"); WebResponse res = wc.getResponse(req); System.out.println(res.getText()); }
HtmlUnit example
HTMLããã¥ã¡ã³ããèæ ®ããä½ããHTMLããã¥ã¡ã³ãã表ç¾ããObjectã使ç¨ããJWebUnitã§ã使ç¨ããã¦ããã
public void testSimple() throws Exception { WebClient webClient = new WebClient(); HtmlPage page = (HtmlPage)webClient.getPage(new URL("http://htmlunit.sourceforge.net/")); assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText()); }
MaxQ
- jythonã§ãã¹ããè¨è¿°ããmaxqãç´æ¥å®è¡ããã¨ç«ã¡ä¸ããJavaã®GUIã¢ããªã±ã¼ã·ã§ã³ä¸ã§jythonãå ¥åãTestãå®è¡ããããã³ãã³ãã©ã¤ã³ããjythonãã¡ã¤ã«ãæå®ãã¦
maxq -r test.py
ã§å®è¡å¯è½ï¼ä»¥ä¸ã®scriptã§åä½ï¼ã
- ãã¹ãã¹ã¯ãªãããè¨é²ããHTTP proxyã¨ãã¹ãããã¬ã¤ããã¯ã¦ã¼ãã£ãªãã£ãå«ãã§ãã¦ãããã·ã¬ã³ã¼ãã¯èªåçã«ãã©ã¼ã ã«ãã¹ããããå¤æ°ãã¹ãã¢ãã¾ãã
- MaxQ example test.py
from com.bitmechanic.maxq import HttpTestCase from junit.textui import TestRunner class SampleTest(HttpTestCase): def __init__(self): HttpTestCase.__init__(self, "") def testMaxq(self): print "Testing MaxQ" self.assertTrue(1 == 1) self.get("http://maxq.tigris.org/") #self.printResponse() print self.getResponse() if __name__ == '__main__': test = SampleTest() test.testMaxq()
å人çã«ã¯ãpythonã®åå¼·ãã¦ãã«è¯ãã¨æãã¾ãã
Canoo WebTest
å種è¨å®ãã¡ã¤ã«ãæ¸ãã®ãå°ã
é¢åã
Web Testingã¾ã¨ã
Seleniumãèªç¥åº¦ã使ãããããè¯ãããJameleonãå人çã«ã¯ãå§ããããã
ããå°ãJameleonã¨MaxQãæãä¸ãã¦è§¦ã£ã¦ã¿ããã¨æãã
Javaã«æ
£ãã人ã§ããã°ãjWebUnitãHtmlUnitãHttpUnitãç´æçã§ãããã使ãããªããã
åºæ¬çã«ã¯ãWebã®ãã¹ããªã®ã§Java以å¤ã§ã使ç¨å¯è½ã
è² è·ãã¹ã
name | URL | Ver. | Licence | Recommend |
---|---|---|---|---|
JMeter | http://jakarta.apache.org/jmeter/ | 2.3.2 | ASL | |
WebLOAD | http://www.webload.org/ | 8.3 | GPL | |
Grinder3 | http://grinder.sourceforge.net/ | 3.1 | GPL | |
OpenSTA | http://www.opensta.org/ | 1.4.4 | GPL |
Grinder3
ããã©ã¼ãã³ã¹ãã¹ã±ã¼ã©ããªãã£ã ãã§ãªããæ¤è¨¼å¯è½æ§ï¼æ»ãå¤ãæ£ãããã¨ãæ¤è¨¼ãããã¨ï¼ãããã
ãã¹ãã¹ã¯ãªããã¯(COM/Javaãªãã¸ã§ã¯ãã¨çµ±åããã)JavaScriptã§è¨è¿°ãããã¢ããªã±ã¼ã·ã§ã³ã®å
¨ã¦ã®å±¤ããã¹ã
ããããã®è¤æ°ã®ãããã³ã«ï¼Web(Ajaxããµãã¼ãããREST/HTTP)ãSOAP/XMLãFTPãSMTPï¼ããµãã¼ãã
ãã¹ãã¹ã¯ãªãããå®è¡ããããã«ä½¿ç¨ãããJythonã¹ã¯ãªããã¨ã³ã¸ã³ã®ãµãã¼ãã
HTTPãã¹ãã¯HTTPãããã·ããã³ãã®ä»ã®å¤æ´ãéãã¦å®è¡ãããã¨ãã§ããã
Grinder3ã«é¢ãã¦ã¯å®éã«ä»¥ä¸ã®ã¹ã¯ãªããã§ãã¹ããã¦ã¿ã¾ããã
以ä¸ã§èµ·å
java -cp grinder.jar net.grinder.Console
java -cp grinder.jar -Dgrinder.logDirectory="log/log.txt" net.grinder.Grinder
- simple http sample
from net.grinder.script.Grinder import grinder from net.grinder.script import Test from net.grinder.plugin.http import HTTPRequest test1 = Test(1, "Request resource") request1 = test1.wrap(HTTPRequest()) class TestRunner: def __call__(self): result = request1.GET("http://grinder.sourceforge.net/") writeToFile(result.text) def writeToFile(text): filename = grinder.getFilenameFactory().createFilename( "test", "-%d.html" % grinder.runNumber) file = open(filename, "w") print >> file, text file.close()
WebLOAD
ãªã¼ãã³ã½ã¼ã¹çã§ã¯ãããã¤ãã®æ©è½ãéå®ããã¦ãããããã¨ãã¨åç¨ã ã£ãã ãã«æçãã製åããããã¾ããã
WebLOADã¯ãFlexã®è² è·ãã¹ããåºæ¥ãã¨ãããæ大ã®é
åã
ç°¡åãªå人æ
å ±ãå
¥åããã°ãã¦ã³ãã¼ãåºæ¥ãã¤ã³ã¹ãã¼ã«ã¬ã¤ãã®PDFã¨ã¯ã¤ãã¯ã¹ã¿ã¼ãã®HTMLãç¨æããã¦ããã
ã¤ã³ã¹ãã¼ã«ã«ã¯postgreSQLãå¿
é ã§ï¼ã¤ã³ã¹ãã¼ã«ããéã«èªåã§postgreSQLãã¤ã³ã¹ãã¼ã«ããã¾ããï¼ãå®è¡ããã«ã¯åãµã¤ãããã©ã¤ã»ã³ã¹ãã¡ã¤ã«ããã¦ã³ãã¼ããèªè¨¼ããå¿
è¦ãããã
AMFã«å ãã¦XMLãSOAPã¨RESTãå«ãä»ã®Webã¡ãã»ã¼ã¸ãããã³ã«ããµãã¼ãããã¦ããã
åããã¦ã¿ã¦ããªãé«æ©è½ãªå°è±¡ãåããã
OpenSTA
è² è·ãã¹ããã¼ã«ã§ãããæä½æ¹æ³ãç°¡åã§ãExcelã»CSVã»TEXTãªã©ã®å½¢å¼ã¸ã®ã¨ã¯ã¹ãã¼ãåã³å³å½¢ã§è¡¨ç¤ºãããªã©ã®æ©è½ãåãã¦ãã¾ãã
éçºã2007å¹´10æã«1.4.4ããªãªã¼ã¹ããå¾ãæ´»åãåæ»ãã¦ãã¦ãWindowsç°å¢ã§ãã使ç¨ã§ããªãããã«
ãã£ããã£å¯¾è±¡ã®ãã©ã¦ã¶ãIE4ã6ã¨NetScapeãã対å¿åºæ¥ã¦ããããå°ç¨ã®ã¹ã¯ãªããè¨èªãå¦ç¿ããå¿
è¦ãããã®ã§é¸æè¢ããã¯ã¯ãããæ¹ãè¯ãã¨æãã
æ©è½ã¯è±å¯ããã ãUIãç´æçã§ã¯ç¡ãã
è² è·ãã¹ã ã¾ã¨ã
JMeterãæ
å ±éãèªç¥åº¦ã¨ãã«é«ãããå人çã«ã¯ãWebLOADã¨Grinder3ã«æ³¨ç®ã
WebLOADã§Flexã®ãã¹ããå®éã«è¡ã£ã¦ããå度ãè©ä¾¡ãããã
Grinder3ã¯MaxQã¨åæ§ã«jythonããµãã¼ããã¦ããã®ã§ãå¦ç¿æ欲ãããã°æ¯éæ¡ç¨ãã¦æ¬²ããã
OpenSTAã¯é¸æè¢ããã¯ãããæ¹ãè¯ãã¨æãããã
ãã®ä»
Cactus
WEBã³ã³ããä¸ã§åä½ãããã¹ãã£ã³ã°ãã¬ã¼ã ã¯ã¼ã¯
http://jakarta.apache.org/cactus/index.html
Eclipse TPTP
Eclipseã§ãã¹ãã¨ããã©ã¼ãã³ã¹ãã¼ã«ã®ãã©ãããã©ã¼ã
http://www.eclipse.org/tptp/
FindBugs
Javaã³ã¼ãã®ãã°æ¤åºã®ããã«è¨è¨ããããªã¼ãã³ã½ã¼ã¹ã®éçåæãã¼ã«
http://findbugs.sourceforge.net/
Hudson
CIãã¼ã«ãå¤ãã®ãªã¼ãã³ã½ã¼ã¹ã§å©ç¨ããã¦ãããã¤ã³ã¹ãã¼ã«ã®å®¹æããæ¡å¼µæ§ã®é«ã
æ
å ±éã®å¤ãã«å®è©ããããCIãã¼ã«ã§ã¯æããå§ããæ¥æ¬äººãªãHudsonã使ç¨ããªãã¨ã¢ã°ãªã
https://hudson.dev.java.net/
Continuum
Cobertura
ãã¹ã網ç¾
çãã¼ã«
http://cobertura.sourceforge.net/
Emma
ãã¹ã網ç¾
çãã¼ã«
http://emma.sourceforge.net/
FitNess
åãå
¥ããã¹ããFIT+Wikiãµã¼ãã§Webãããã¹ãè¨è¿°åºæ¥ãExcelã·ã¼ããããè²¼ãä»ãã§ããï¼åä½ç¢ºèªãã¦ããªãï¼
http://fitnesse.org/
Stiq
StoryTestIQã®ç¥ã§ãSeleniumã¨FitNessãããã·ã¥ã¢ããã
Story Test-Driven Developmentãhttp://industrialxp.org/storyTdd.html
http://storytestiq.solutionsiq.com/wiki/Main_Pageï¼åä½ç¢ºèªãã¦ããªãï¼
DBUnit
ãã¼ã¿ãã¼ã¹ãæä½ããã¯ã©ã¹ã®ãã¹ãããã°ã©ã ãä½æããããã®ãã¬ã¼ã ã¯ã¼ã¯
http://www.dbunit.org/
DBMonster
ãã¼ã¿ãã¼ã¹ã«ãã¹ãç¨ã©ã³ãã ãã¼ã¿ãå
¥ãã¦ããããã¼ã«ã
http://dbmonster.kernelpanic.pl/
EasyMock
ã¢ãã¯ãªãã¸ã§ã¯ã
http://easymock.org/
jMock
ã¢ãã¯ãªãã¸ã§ã¯ã
http://jmock.org/
XMLUnit
XMLãã¹ãã£ã³ã°ãã¬ã¼ã ã¯ã¼ã¯ãå®å
¨ä¸è´ã ãã§ã¯ãªãé¡ä¼¼ä¸è´ã®æ¤è¨¼ãè¡ããã
http://xmlunit.sourceforge.net/
UISpec4j
Swing GUIã¢ããªã±ã¼ã·ã§ã³ã®Testãç°¡åã«è¡ãããã®ã©ã¤ãã©ãªã§JUnit,TestNGä¸ã«æ§ç¯ããã¦ããã
â»JDKã®ãã¼ã¸ã§ã³æ¯ã«ãã¤ããªãæä¾ããã¦ããã5.xã¨6.xã¯2.0-RC3ãææ°ã1.4.xã¯1.5ã
http://www.uispec4j.org/
JTableã®è¡¨ç¤ºãã¹ãã¯ä»¥ä¸ã®éãã
public void testContacts() { Table contacts = getMainWindow().getTable(); assertTrue(contacts.contentEquals(new Object[][]{ {"John", "12", Boolean.FALSE}, {"Sylvia", "43", Boolean.TRUE}, {"Bill", "31", Boolean.FALSE}})); }
id:kaisehããã«ãå§ãããã