yfj2’s Automatic Web Test Related Blog

yfj2のWEBテスト自動化に関わるブログ

【入門】Geb+SpockではじめるWebテスト~Maven編~ / How to run test by Maven command using Geb+Spock?

【入門】Geb+SpockではじめるWebテスト~Maven編~ / How to run test by Maven command using Geb+Spock?
著者:ふじさわゆうき

この記事は、以下の記事の続きです。
初めて訪問した方は以下の記事を参照してください。

目次 / Table of Contents

  1. 前回までのあらすじ / Overview of up to the previous article
  2. 今回の目的 / The goal of this article
  3. Mavenのメリット / Maven benefits
  4. Mavenインストール / Maven installation
  5. Mavenコマンドによるテスト実行 / The test run by Maven command
  6. まとめ / Summary

1. 前回までのあらすじ

  1. Gebとは何かの説明 / The description of what is Geb
  2. Gebのメリット説明 / Description of Geb benefits
  3. 「Eclipse + maven + Geb + Spock」での開発環境構築説明 / Development environment construction described with using "Geb + Spock"
  4. サンプルプログラム実装 / Sample program implementation
    1. google検索⇒検索結果⇒WIKIという流れのWebテスト実施 / Web test explanation that "google search ⇒ results ⇒WIKI"
    2. 「Geb + Spock」による上記Webテストの実施 / Implementation of the above Web test using the "Geb + Spock"
  5. クロスブラウザの説明 / Description of cross-browser
  6. スクリーンショット出力方法の説明 / Description of the screen shot output method

2. 今回の目的 / The goal of this article

  • Mavenで「Geb + Spock」のWebテストを実行できるようにすること / To run web test of "Geb + Spock" Using Maven
    • Jenkinsとの連携に必須 / Required in collaboration with Jenkins

3. Mavenのメリット/ Maven benefits

以下のサイト等参照してください / Please refer to the following site, etc.

4. Mavenインストール / Maven installation

  1. Mavenをダウンロードする / Download Maven
    • Maven – Download Apache Maven
    • "apache-maven-3.3.3-bin.zip"をダウンロード / Download "apache-maven-3.3.3-bin.zip"
    • "C:\apache-maven-3.3.3"に解凍する / Unzip "apache-maven-3.3.3-bin.zip" and move to "apache-maven-3.3.3"
  2. 環境変数の設定 / Setting Environment Variables
    • システムのプロパティ > 詳細設定 > 環境変数 > Path > 編集
      • "C:\apache-maven-3.3.3\bin"を追記する / Append "C:\apache-maven-3.3.3\bin"
    • f:id:yfj2:20141129204516p:plain
    • f:id:yfj2:20141129204812p:plain
    • f:id:yfj2:20141129204818p:plain
  3. mvnコマンド実行 / mvn command execution
    • コマンドプロンプトを起動する / Start windows command prompt
    • "mvn -v"と実行する / Run "mvn -v"
    • Mavenのバージョン等が表示されたらインストール完了 / Installation is complete if Maven version confirmation
    • f:id:yfj2:20141129231155p:plain

5. MavenコマンドによるWebテスト実行 / The test run by Maven command

  1. コマンドプロンプトを起動する / Start windows command prompt
  2. GoogleWikipediaTestに移動する / Moved to GoogleWikipediaTest
    • cd [Eclipse Workspace Path]\GoogleWikipediaTest
      • (例) cd c:\gebworkspace\GoogleWikipediaTest
  3. mavenコマンドの実行 / Execution of Maven command
    • mvn test
  4. テストが起動したらOK / It is OK, if the test starts
    • f:id:yfj2:20141129233701p:plain

8. まとめ / Summary

  1. Mavenをダウンロードする / Download Maven
  2. GoogleWikipediaTestのディレクトリで"mvn test"コマンドを実行する / Run "mvn test" command in the GoogleWikipediaTest of directory
  3. テストが実行される / / It is OK, if the test starts