Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

The purpose of the java-idp-integration-tests project is to test the IdP using Selenium. Only a handful of profile flows are currently tested.

The IdP is run in a java.lang.Process to separate it from the tests themselves. Consequently, the testbed is used to provide a mock SP as well as storage interface to validate tests.

Maven is used to :

  • retrieve and unpack the Jetty (jetty-distribution) and IdP (idp-distribution) artifacts

  • retrieve and deploy the testbed webapp

  • add test credentials, flows, metadata, and views from idp-conf to the IdP

resulting This results in a test-distributions directory containing Jetty and the IdP + testbed.

Each test class instance (of the abstract test class BaseIntegrationTest) creates an idp.home directory. This per-test-class idp.home directory is usually customized by test classes or instances using Java, and is deleted if all tests are successful. Helper methods are provided in the abstract test class to customize idp.home by copying or modifying configuration files, etc. Each test class instance runs the IdP + testbed on separate ports so that tests may be run in parallel, this may be disabled during development.

...

Test methods may test SAML profiles by validating assertions displayed by the browser via the testbed's mock SP. The same SAML validators are used in browser tests (java-idp-integration-tests) as well as flow tests (idp-conf).

Setup 

Source Code

Checkout the java-idp-integration-tests project. See Git Repository Access for details.

git clone git@git.shibboleth.net:java-idp-integration-tests

cd javacd java-idp-integration-tests

Initial Maven Build

Info

Build using Maven from the command line, not Eclipse.

...

At this point the java-idp-integration-tests directory should contain a test-distributions directory containing the IdP and Jetty distributions. You should be able to run tests via Maven from the command line or import the project into Eclipse and run them using the TestNG plugin.

Sauce Labs Authentication

To run remote tests on Sauce Labs, an account is required.

Populate the ~/.sauce-ondemand file with your username and access key. For example

...

~/.sauce-ondemand
Code Block
languagebash
username = myname-shibboleth
key = 789z... 

Run Tests

Tests may be run from Maven on the command line or via Eclipse and the TestNG plugin.

...

The Maven POM of the integration tests project unpacks the IdP (idp-distribution) and Jetty (jetty-distribution) to the test-distributions directory, deploys the testbed (idp-testbed), and installs test flows from idp-conf. Each instance of the abstract test class (BaseIntegrationTest) copies the default idp.home directory to a new per-test-class idp.home directory named by a timestamp.

test-distributions/

Description

yyyyMMdd-HHmmssSS

Per-test-class idp.home directory.

jetty-distribution-<version>

Jetty.

shibboleth-identity-provider-<version>

Default idp.home directory : idp-distribution, idp-testbed, and test flows from idp-conf.

The per-test-class idp.home directory is deleted only if all tests pass.

...

To use the default ports (8080, 8443, and 9443 for backchannel), disable the setUpAvailablePorts() method :

...

BaseIntegrationTest.java
Code Block
@BeforeClass(enabled = false)
public void setUpAvailablePorts() {
 ...

...

Possible values for browser, OS, and version :

Key

Values Documentation

browser

BrowserType.java

os

Platorm.java

version

 

Some example values  :

browser

os

"internet explorer"

"Windows Server 2012"

"iPhone"

"MAC"

 

 

Selecting a Browser via System Property

Instances of BrowserData.java are populated from the SAUCE_ONDEMAND_BROWSERS system property. For example :

...

To test a remote browser set the following system properties :

Property Name

Property Value

Description

SELENIUM_IS_REMOTE

true

Remote browser if true, local browser otherwise.

server.address

IP address

IP address of server.

server.address.private

IP address

Optional private IP address of server.

For example :

-DSELENIUM_IS_REMOTE=true -Dserver.address=108.163.128.190

...