Skip to content
Tomas Sedmik edited this page Jul 23, 2014 · 2 revisions

JBoss Fuse Tooling Tests

Prerequisites

  • Java 6 (JDK) or higher only from Oracle and OpenJDK (IBM JDK, ... is not supported)
  • JBDS 7.1.1.GA or higher with JBDSIS 7.0.1.GA or higher
  • Maven 3 or higher
  • Git 1.8.3.1 or higher
  • some VNC server + viewer (e.g. TigerVNC)

Environment preparation

Step 0 - configure Maven repositories

To proper work of Maven, we need to set settings.xml in ~/.m2 folder (just copy the file into the location).

Step 1 - obtain all required Git repositories

We need these repositories:

To get them use these commands:

git clone https://github.com/jbosstools/jbosstools-integration-stack-tests.git
git clone https://github.com/apodhrad/server-installer.git

Step 2 - run and connect to a different display (via VNCviewer)

We use a different display to separate a test run from our current session. We can use e.g. TigerVNC and these commands:

vncserver :2 -geometry 1600x900 -depth 24
vncviewer localhost:2 &
  • vncserver starts a new instance of VNC server with subsequent parameters:
    • :2 - display's number
    • -geometry 1600x900 - screen resolution
    • -depth 24 - color depth in bits
  • vncviewer connects via VNC protocol to the given address (display's number can be specified)

Step 3 - install a JBoss Fuse server

cd server-installer/fuse-6.1.0.GA
mvn clean install

It downloads and installs a vanilla JBoss Fuse Server. Please, note the following points:

  • -Dbuild=379 - build of the JBoss Fuse Server can be changed with this parameter
  • in target folder is created a file server-setting.xml. It is an important file which contains settings information (path to the server included) about the JBoss Fuse Server used by tests (see Step 3).
  • with maven's -D parameter can be changed some attributes about JBoss Fuse Server settings used during creation a new server in JBoss Developer Studio (e.g. -Dport=8101).

Step 4 - install and configure JBDS (only if we run tests with JBDS)

We can use prepared solution, that installs JBDS with all necessary plugins (RedDeer, SWTBot, JBoss Tools, ...) for write and run tests for JBoss Tools. In this case we need this repository:

To install JBDS with all necessary plugins use these commands:

git clone https://github.com/apodhrad/jbds-installer.git
cd jbds-installer/jbds-7.1.1.GA_jbdsis-7.0.2.GA
mvn clean install -Pqa
  • line 2 - open latest jbds-x.x.x.GA_jbdsis-x.x.x.GA
  • line 3 - build downloads JBDS and all required features
  • -Pqa - profile qa adds features for write and run tests for JBoss Tools

Run automated tests with - JBDS/Eclipse

Step 1 - import projects into JBDS/Eclipse

  1. Select File --> Import --> Maven --> Existing Maven Projects
  2. Browse into the jbosstools-integration-stack-tests/plugins (this Git repository we obtained in step 1 in section Environment preparation)
  3. Select org.jboss.tools.fuse.reddeer
  4. Click on Finish button
  5. Select File --> Import --> Maven --> Existing Maven Projects
  6. Browse into the jbosstools-integration-stack-tests/tests
  7. Select org.jboss.tools.fuse.ui.bot.test
  8. Click on Finish button

Step 2 - setup run/debug configuration

In folder launchers is prepared default run configuration for JBoss Fuse Tooling. We can run it via Run --> Run/Debug Configurations --> RedDeer Test --> Fuse Tooling. This launcher runs smoke tests suite. We can simply change test suite/class via Test class.

If we want to create our own launcher, here is the recipe:

  • Select Run --> Run/Debug Configurations...
  • Select RedDeer Test --> press New
  • Type Name and on tab Test select Run a single test
  • Select org.jboss.tools.fuse.ui.bot.test as Project
  • Select via Search... button some test suite or test case
  • Important! - on tab Arguments set following VM arguments:
    1. -Dosgi.requiredJavaVersion=1.6 -XX:MaxPermSize=256m -Xms40m -Xmx512m
    2. -Dreddeer.config=... - this parameter must be set and should contains a path to the server-setting.xml file, that is created in Step 3 of section Environment Preparation.
    3. -Dusage_reporting_enabled=false - close Usage reporting window (displayed on JBDS startup)
  • on tab Environment:
    1. set variable DISPLAY=:2 - it allows us to see test run on different display (see step 2 of section Environment Preparation).

Note: If we run FabricInCloudTest, we need to set following VM arguments (in step 6 above):

  • -Dec2.id=... - Access key ID for Amazon EC2
  • -Dec2.pass=... - Secret Access Key for Amazon EC2
  • -Dec2.email=... - User e-mail address for Amazon EC2
  • -Dmaven.test.failure.ignore=true - if test fails, this ensure execution of amazon-terminator (terminate all JBoss Fuse Fabric instances on Amazon EC2 Cloud)

Step 3 - run tests for JBoss Fuse Tooling

  • Simply run configuration created in Step 2
  • Open some VNC viewer application and connect to localhost:2 to see test run

Run automated tests with - Maven

Note: To run tests with Maven we can use run.sh script or execute following commands:

cd jbosstools-integration-stack-tests
DISPLAY=:2 mvn clean verify -pl tests/org.jboss.tools.fuse.ui.bot.test -am -Dreddeer.config=*path_to_the_server-setting.xml_file* -Dtest=*name_of_the_test_case_or_suite*

If we execute these commands, test will be run. Please, note the following points:

  • -pl tests/org.jboss.tools.fuse.ui.bot.test -am - specify a project (containing tests for JBoss Fuse Tooling) to build. It also build all dependent project - in this case tests/org.jboss.tools.fuse.reddeer which contains some sort of framework manipulates with JBoss Fuse Tooling.
  • -Dreddeer.config=... - this parameter must be set and should contains a path to the server-setting.xml file, that is created in Step 3 of section Environment Preparation.
  • -Dtest=... - if we want to run a specific test case or suite, use this parameter (e.g. -Dtest=ServerTest runs ServerTest.java only).
  • -DdebugPort=8123 - if we want to debug tests (ran with Maven) in JBoss Developer Studio or Eclipse use this parameter.

Note: If we run FabricInCloudTest, we need to set following VM arguments (in step 6 above):

  • -Dec2.id=... - Access key ID for Amazon EC2
  • -Dec2.pass=... - Secret Access Key for Amazon EC2
  • -Dec2.email=... - User e-mail address for Amazon EC2
  • -Dmaven.test.failure.ignore=true - if test fails, this ensure execution of amazon-terminator (terminate all JBoss Fuse Fabric instances on Amazon EC2 Cloud)

So we run this test with these commands:

cd jbosstools-integration-stack-tests
DISPLAY=:2 mvn clean verify -pl tests/org.jboss.tools.fuse.ui.bot.test -am -Dreddeer.config=*path_to_the_server-setting.xml_file* -Dtest=FabricInCloudTest -Dec2.id=*ID_for_Amazon_EC2* -Dec2.pass=*Password_for_Amazon_EC2* -Dec2.email=*user_email_for_Amazon_EC2* -Dmaven.test.failure.ignore=true