ãIEä¸ã§DOMãCSSãæ¸ãæãå¯è½ãªæ¡å¼µãDOM Helperã
ãã®å ´ã§æ¸ãæãã§ããã®ã¯ãããã§ã.Net Framework2.0以éãå¿ è¦ãããã
ãWebéçºãæ¯æ´ãããã¼ã«ãã¼for IE.
MS製ã ã(?)ãã£ã¡ãã¤ã³ã¹ãã¼ã«ãã¦ã¿ãã
ãSeleniumã§åçãªå¤ãæ±ã
ãã¹ãã«ããã¦ã¯å試é¨é
ç®ã«è¦åã£ããã¹ããã¼ã¿ã使ç¨ããããã§ããããä»æ¥ã®æ¥ä»ããªã©åçãªå¤ãæ±ããªããã°ãããªãå ´åãããã¾ããä¾ãã°æ¸ç±ã®è²¸ãåºããè¡ãã¨ã貸åºæ¥ããã¢ããªã±ã¼ã·ã§ã³ã§è¨é²ããããã¨ããå ´åã«è²¸åºæ¥ã¯ãã¹ããå®è¡ããæ¥ä»ã«ãªãããããã¹ãã±ã¼ã¹ã§äºãåºå®ããå¤ãæ¸ãã¦ããããã«ã¯ããã¾ããã
ãã®ãããªåçãªå¤ãSeleniumã«ããã¦æ±ãæ¹æ³ã試ãã¦ã¿ã¾ããã
Javascriptï¼å¤æ°ã使ç¨ããã
ã¾ãã¯ãSeleniumã§æä¾ããã¦ããå¤æ°ã®ä»çµã¿ãå©ç¨ããæ¹æ³ã§ãã
storeã³ãã³ãã使ãã¨javascriptã使ã£ã¦åºåããå¤ãå¤æ°ã«å
¥ãããã¨ãã§ãã¾ãã
ããã¦ãã以éã®ã³ãã³ãã§ã¯%å¤æ°å%ã¨æå®ãããã¨ã§å¤æ°å¤ã使ç¨ãããã¨ãã§ãã¾ããããã§ã¯ä»æ¥ã®æ¥ä»ãåå¾ãã¦ãMM/DDãã¨ããå½¢å¼ã§å¤æ°å¤ãè¨å®ãã¦ã¿ã¾ãã
<!-- æ¥ä»ãåå¾ãã¦å¤æ°TODAYãä½æ --> <tr> <td>store</td> <td>javascript{((new Date()).getMonth() + 1) + '/' + (new Date()).getDate()}</td> <td>TODAY</td> </tr> <!-- å¤æ°TODAYã使ç¨ãã¦ã³ãã³ããå®è¡ --> <tr> <td>type</td> <td>searchword</td> <td>${TODAY}</td> </tr> <tr> <td>verifyText</td> <td>id=BookRentDay</td> <td>${TODAY}</td> </tr>
ä¸è¨å¤æ°ãå©ç¨ããçµæã¯ä»¥ä¸ã®ããã«ãªãã¾ã(ãã¼ã¯ã¼ãæ¬)ã
Javascriptã¯ä¸è¨ã®ãããªåæã ãã§ãªããè¤æ°ã®æã使ããã¨ãå¯è½ã§ããããã§ã¯ãYYYYå¹´MMæDDæ¥ãã¨ããæ¸å¼ã§å¤æ°ã«è¨å®ãã¦ã¿ã¾ãã
<tr> <td>store</td> <td>javascript{td = new Date();yy = td.getYear(); mm = td.getMonth() + 1;dd = td.getDate(); yy + 'å¹´' + mm + 'æ' + dd + 'æ¥'}</td> <td>TODAY</td> </tr> ã以ä¸åæ§ã
ãã¡ãã®å©ç¨çµæã¯ä»¥ä¸ã®éãã§ãã
ãã®ããã«Javascriptã使ã£ã¦åå¾åã³å å·¥ããå¤ãå¤æ°ã¨ãã¦ãã¹ãã±ã¼ã¹ã§ä½¿ç¨ãããã¨ãã§ãã¾ãã
DbUnitã§DBæ´æ°ã®æå¾ å¤ãæ¤è¨¼
DBæ´æ°ãä¼´ããã¹ãã®å ´åãSeleniumåä½ã§ã¯ç»é¢ä¸ã®è¡¨ç¤ºã¯æ¤è¨¼ã§ãã¾ãããDBãã®ãã®ãã¡ããã¨æ´æ°ããã¦ãããã©ããã®æ¤è¨¼ã¯ã§ãã¾ããããã®ãããªå ´åã«ã¯DbUnitãå©ç¨ããã¨ããã®ãä¸ã¤ã®ã¢ã¤ãã¢ãã¨æãã¾ããDbUnitãå©ç¨ãããDBæ´æ°æ¤è¨¼ç¨ãµã¼ãã¬ããããä½æãã¦Seleniumã®ãã¹ãã±ã¼ã¹ããå¼ã³åºãã¨ããããã§ãã
DBæ´æ°æ¤è¨¼ç¨ãµã¼ãã¬ãã Excelã§DBæ´æ°ã®æå¾ å¤ãä½æã<-ãassertã->ãDBã®å¤ãåå¾
DbUnitã使ç¨ããéã®ä¸ã¤ã®æ¹æ³ã¨ãã¦Excelãã¡ã¤ã«ãç¨ããæ¹æ³ãããã¾ããããã®Excelãã¡ã¤ã«(æ´æ°æå¾ å¤)ã«åçãªå¤ãè¨å®ããæ¹æ³ãæ¸ãã¦ããã¾ãã
ã¾ããExcelãã¡ã¤ã«ã§ã¯åçãªå¤ãè¨å®ãããã»ã«ã«å¤æ°ãè¨è¿°ãã¾ããããã§ã¯[TODAY]ã¨ããå¤æ°ãè¨å®ãã¦ã¿ã¾ããã
javaå´ã®ã½ã¼ã¹ã§ã¯ãReplacementDataSetã¯ã©ã¹ã®addReplacementObjectã¡ã½ããã使ç¨ãã¦ã¨ã¯ã»ã«ã§è¨è¿°ãã[TODAY]é¨åã«ä»æ¥ã®æ¥ä»ãè¨å®ãã¦ãã¾ãããã®ä¸ã§getTableã¡ã½ããã§æå®ãããã¼ãã«(ãã®ä¾ã§ã¯rentalãã¼ãã«)ã®æ å ±ãåå¾ãã¦ãã¾ãã
// å®éã®ãã¼ãã«æ å ±ãåå¾ IDataSet actualDataSet = dbconn.createDataSet(); ITable actualTable = actualDataSet.getTable("rental"); // æå¾ å¤ãã¼ãã«æ å ±ãåå¾ File expectedFile = ResourceUtils.getFile( this.getClass().getResource( XLS_EXPT_DIR + "/expectedData.xls")); ReplacementDataSet expectedDataSet = new ReplacementDataSet(new XlsDataSet(expectedFile)); expectedDataSet.addReplacementObject("[TODAY]", dfm.format(dt)); ITable expectedTable = expectedDataSet.getTable("rental"); // å®éã®ãã¼ãã«æ å ±ã¨æå¾ å¤ã®ãã¼ãã«æ å ±ãæ¯è¼ãã¦æ¤è¨¼ Assertion.assertEquals(expectedTable, actualTable);