liguofeng29’s blog

個人勉強用ブログだっす。

2017-03-01から1ヶ月間の記事一覧

spring4 - @Qualifier, alias

@Qualifierは、bean名を指定してDIを行う package spring4.second; public interface SomeService { public String getMessage(); } package spring4.second; import org.springframework.stereotype.Component; @Component("SomeServiceAImpl") public cl…

Spring4 - BeanFactoryPostProcessor

Beanを遅延生成させる @Component public class LazyInitBeanFactoryPostProcessor implements BeanFactoryPostProcessor { @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { for (Stri…

jQueryを埋め込む

if (!window.jQuery) { document.body.appendChild((function(){ var s = document.createElement("script"); s.type = "text/javascript"; s.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"; return s; })()); } $.fn.jquery

GebConfig.groovyに共通定数を追加する

browser.config.rawConfig.[key] GebConfig.groovy id = "test@gmail.com" pass = "password" SomeScript.groovy browser.config.rawConfig.id browser.config.rawConfig.pass

groovy,geb(selenium),spockによる自動化テスト その11- Report機能

gebは検証pageに対するレポート機能(HTML,PNG)を提供している。 ・シナリオ リスナー定義&追加(レポートする度にprintlnが実行される) googleに移動する レポートする yahooに移動する レポートする googleに移動する レポートする yahooに移動する レポー…

groovy,geb(selenium),spockによる自動化テスト その10- GebConfig.groovy

GebConfig.groovyはGebの環境設定ファイルである。 参考: http://www.gebish.org/manual/1.1/ Geb attempts to load a ConfigSlurper script named GebConfig.groovy from the default package (in other words, in the root of a directory that is on the…

groovy,geb(selenium),spockによる自動化テスト その9 - Page Object Pattern - Module

複数の画面で使う共通部品(メニュとか)はMoudleを継承することで再利用できる。 import geb.Browser import geb.Module import geb.Page Browser.drive { to YahooTopUseModule 検索モジュール.検索欄.value("検索内容") 検索モジュール.検索ボタン.click() …

groovy,geb(selenium),spockによる自動化テスト その8 - Page Object Pattern - Pageの属性

Pageオブジェクトの属性 url属性 : PageのURLを表す ・シナリオ 相対パス指定のpageに移動 (to ExamplePage1) 絶対パス指定のpageに移動 (to ExamplePage2) 引数指定のpageに移動 (to ExamplePageWithArguments) インスタンス引数指定のpageに移動 (to Ex…

groovy,geb(selenium),spockによる自動化テスト その7 - Page Object Pattern

gebのPage Object Page Object Patternとは? PageObjectデザインパターンとは、アプリケーションの画面を1つのオブジェクトとしてとらえるデザインパターンの1種のことです。 Seleniumの公式サイトでも推奨されている、保守性の高いテストコードの書き方…

groovy,geb(selenium),spockによる自動化テスト その6

gebでjavascriptを利用する javascript変数を取得 メソッド呼び出し js追加 script6.html <html> <title>for javascript</title> <script type="text/javascript"> var var1 = 100; function add(a, b) { return a + b; } </script> <body> </body> </html> script6_js.groovy /** * Geb for javascript * * http://www.gebish.org/manual/ * * …

groovy,geb(selenium),spockによる自動化テスト その5

gebでframeを操作する方法 直接操作する Page Objectを利用する script5.html <html> <body> <iframe name="header" src="script5_header_frame.html"></iframe> <iframe id="content" src="script5_content_frame.html"></iframe> <iframe id="footer" src="script5_footer_frame.html"></iframe> </body> </html> script5_header_frame.html …

groovy,geb(selenium),spockによる自動化テスト その4

Geb API form, input, checkbox, radioなどのHTMLElementの操作する script4.html <form id="form1"> <div class="input1"> <input name="username1" type="text" placeholder="input your name"> <input name="password1" type="text" placeholder="input your password"> </div> <div class="input2"> </div></form>

groovy,geb(selenium),spockによる自動化テスト その3

Geb Navigator API gebを使えば、jqueryのselectorに似ている書き方で要素page要素を取得することができる。 script3.html <div>div1 text</div> <div>div2 text</div> <div class="search1"> <form onsubmit="return bridge();"> <input type="text" placeholder="input keyword" class="input" id="keyword" name="keyword"> <br> </form></div>