Skip to main content
Skip table of contents

Setup and Configuration

Projects extending NRG_Selenium should be set up as maven projects. Then, you can simply grab the dependency below to integrate the framework:

Maven dependency

TEXT
<dependency>
	<groupId>org.nrg</groupId>
	<artifactId>selenium</artifactId>
	<version>4.0-SNAPSHOT</version>
</dependency>

Maven servers

Note that if you do not already have the dependency for NRG_Selenium downloaded, you will not find it on Maven central. Instead, you will need to add the XNAT maven server to your pom.xml, with something like:

XNAT Maven Server

TEXT
<repositories>
    <repository>
        <id>org.nrg.xnat.maven.libraries.release</id>
        <name>XNAT Maven Release Libraries</name>
        <url>http://nrgxnat.jfrog.io/nrgxnat/libs-release</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>org.nrg.xnat.maven.libraries.snapshot</id>
        <name>XNAT Maven Snapshot Libraries</name>
        <url>http://nrgxnat.jfrog.io/nrgxnat/libs-snapshot</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
    <repository>
        <id>org.nrg.maven.artifacts.remote</id>
        <name>XNAT Remote Maven Repo</name>
        <url>http://nrgxnat.jfrog.io/nrgxnat/remote-repos</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

 

Out of the box, NRG_Selenium contains support for two main types of configuration: base settings/XNAT settings, and optional JIRA settings. The former of these configuration options is covered below, and the latter is covered in JIRA Zephyr & ZAPI Integration.

For XNAT properties, if properties are defined both in the .properties file (discussed here), and on the command line, NRG_Selenium will give preference to the command line. The framework looks for a properties file in src/test/resources/config. By default, it will attempt to find the file with name local.properties, but the name of a properties file to be used instead can be specified with the setting xnat.config=yourFile.properties, passed on the command line with the -D flag (setting the JIRA config can be done as jira.config=yourFile). Any properties can be passed this way with the format -Dproperty=value. The types of config properties expected break down into two categories, "required" or "optional". The "required" settings must be set appropriately, or NRG_Selenium will refuse to run. The "optional" settings can sometimes be left out (with some tests not being able to run, or functionality lost) depending on the project. Both types of properties can be set either in the properties file, or on the command line.

Required properties

TEXT
xnat.selenium.user - The username of a non-admin account. This account need not exist unless xnat.init is false.
xnat.selenium.password - The password of a non-admin account. This account need not exist unless xnat.init is false.
xnat.version - The version of XNAT the server is running. Currently supported: 1.7, 1.6dev.
xnat.baseurl - The URL for the test environment.

Optional properties

TEXT
xnat.seleniumAdmin.user - The username of an admin account. This account need not exist. Required if xnat.requireAdmin and xnat.init are true.
xnat.seleniumAdmin.password - The password of an admin account. This account need not exist. Required if xnat.requireAdmin and xnat.init are true.
xnat.admin.user - The username of an admin account. This account must exist and is used to create the selenium accounts. Required if xnat.requireAdmin and xnat.init are true.
xnat.admin.password - The password of an admin account. This account must exist and is used to create the selenium accounts. Required if xnat.requireAdmin and xnat.init are true.
xnat.users.email - The email address for the selenium user accounts. This must be a gmail account, preferably with at least 10 characters. Required if xnat.notifiedEmails is nonempty.
xnat.users.email.password - The password for the email address for the selenium user accounts. Required if xnat.notifiedEmails is nonempty.
xnat.defaultTimeout - Timeout in seconds for certain Selenium operations. Defaults to 30.
xnat.browser - Browser to run the tests in, which must be installed on your system. Currently supports Firefox and includes some spotty support for other browsers. Defaults to Firefox.
xnat.init - Should selenium XNAT accounts be set up? Useful to turn off to speed up debugging, when the accounts already exist, or when admin credentials are not provided. Defaults to true.
xnat.dicom.host - Host for XNAT DICOM Receiver. Relevant tests will be skipped if this is not provided.
xnat.dicom.port - Port number for XNAT DICOM Receiver. Relevant tests will be skipped if this is not provided.
xnat.dicom.aetitle - DICOM AE Title for XNAT DICOM Receiver. Relevant tests will be skipped if this is not provided.
xnat.jira - Should a testing cycle be created in JIRA according to settings found in jira.properties? Defaults to false.
xnat.requireAdmin - Are admin accounts required/allowed? Defaults to true. Must be true if xnat.init is true.
xnat.notifiedEmails - Comma-separated list of emails to which results will be sent on test suite completion.
xnat.notifyOnSuccess - Should summary email be sent when all tests pass? Defaults to false. Email is always sent when one or more tests fail (as long as prerequisite properties are set).
xnat.notificationTitle - How should the tests be referred to in the summary email?
xnat.dependencies - Can be set to false to disable dependency checks between certain tests (currently only used for pipelines). Defaults to true.
xnat.pipeline.useDynamicOrdering - For use in pipeline tests only: if set to true, uses Job Shop algorithm to order tests. Otherwise uses the order in which methods are defined in class. Defaults to false.
xnat.pipeline.slots - Number of pipeline queue slots. Used only in pipeline tests. Required if xnat.pipeline.useDynamicOrdering is true.
xnat.timelogs - Can be set to true to generate summary CSVs of tests with runtimes and simple statistics. Defaults to false.
xnat.gitLogs - Can be set to true to turn XNAT and tomcat logs into git repos (requires test_logger XNAT plugin). Defaults to false.
xnat.basic - Can be set to true to only run methods/classes annotated with @Basic (marking either the test or the class is sufficient). If false (or left out), all allowed tests will be run.
xnat.db.url - URL for XNAT database if tests need DB access.
xnat.db.user - User for XNAT database if tests need DB access.
xnat.db.password - Password for XNAT database if tests need DB access.
xnat.ssh.user - Username for an account to use for SSH. Required by some tests.
xnat.ssh.key - Name of SSH private key. Required by some tests.
selenium.version - Version of the Selenium JAR to use. Defaults to the version specified in the selenium_dependencies parent POM if not provided.
dicomEdit.version - Version of DicomEdit being run on the test server. Required for anon tests. Currently supported: 4.4, 6.0.
xnat.producePdf - If set to true, JIRA Reporter will be called to export the test cycle as a PDF. Requires pdflatex (LaTeX installation). Defaults to false.
xnat.captureDom - Specify whether or not the state of the DOM (contents of body in the DOM) should be recorded when a test fails. Defaults to false.
tomcat.version - Name for the service for tomcat. Used over SSH for tests requiring tomcat restart. Defaults to tomcat7.

 

Once all desired properties have been set, simply run the tests with maven:

BASH
$ mvn clean test

with 0 or more properties added on the end.

 

Jenkins

If you wish to use NRG_Selenium test suites with jenkins, install the Xvfb plugin. Under build environment, Xvfb screen should be set to at least 1280x1024x24.
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.