Page tree
Skip to end of metadata
Go to start of metadata

Introduction

This page describes the set-up and usage of the "Schrödinger" testing framework for GUI tests. This feature is officially available up from TODO: INSERT Midpoint VERSION.

Writing tests

If you are looking into writing some tests via the Schrodinger framework or you are executing the tests via some other means than the mvn verify command (e.g. trough your favorite IDE) please also check out this page. 

Initial set-up

To be able to execute the tests written via the Schrodinger framework, there are a couple of initial steps to be taken:

  1. Pick a browser on which you wish to execute the tests and download the corresponding webdriver supported for executing selenium tests
    • the latest ones for the Chrome web browser can be found here
    • Important: chromedriver version must match version of your Chrome
  2. Locate the schrodinger.properties properties file present in midpoint/testing/schrodingertest/src/test/resources/configuration/ and add the following values:
    • For ''username" input the username for the test user (Same as above) 
    • For "password" input the password for the tests user (The user which the tests automation mechanism will use to test the GUI) 
    • For "base_url" input the URL on which the midpoint application resides (e.g. "http://localhost:8080/midpoint")
    • For "webdriver" specify the name of the webdriver system property (e.g. for chrome "webdriver.chrome.driver")
    • For "webdriverLocation" input the path to the web driver executable which you downloaded during "step
    • For "headlessStart" true if the tests should start in "headless" mode (If no value present then by default false)
  3. A JDK 8 (1.8) or higher is needed to be referenced on your path for this feature to work.
    • in general, JDK at least of version used for building midPoint
    • in most cases, JDK 8 should be ok, but since midPoint 4.0, JDK 11 is strongly recommended
  4. Test execution using maven:
    With the project already built, execute the following maven command while in the module named "testing", the profile "Schrodinger" adds the module "schrodingertest" to the execution.

    mvn verify -P schrodinger 


    Optionally execute the former without the profile switch directly in the "schrodingertest" module to start only the Schrodinger test 

  5. You are capable to customize the execution a bit more, this is stated at a further section of this page and essentially that's it. Have fun testing!

Startup

The boot up of the application is indicated with a message similar to this one :

Midpoint (a version of the build you are testing) booting up for integration testing, embedded Tomcat instance configured to listen on port: (port number, either default or configured)

Default parameters and optional test execution arguments

While executing the tests there are also a couple of additional arguments which can be supplied to change the default test environment parameters.

  1. Server port for the embedded Apache Tomcat server. The default value is 8180. Can be changed using the argument "-Dserver.port". Please also bear in mind that the server port has to be changed in the "base_urlproperty in the schrodinger.properties property file as well.
  2. The midpoint home directory. How the default is set is described on the following page. Can be changed using the argument "-Dmidpoint.home"
  3. By default, there is a home directory created during the boot up of Midpoint or there can be one assigned via the "midpoint.home" argument. If you wish to remove such directories after the test execution finishes, there is a cleanup option present as well. By default it is set to "false" but this can be changed using the "-Dcleanup" argument.
  4. The whole bootup, test, clean up part of the integration tests cycle can be ignored if needed using the switch "-DskipTests"

The following will execute the integration test suites using the "/home/midpoint/schrodinger" directory as midpoint home and executing the embedded tomcat using the port "8181". After the suite finishes the process will be stopped and the created or supplied directory will be removed. 

mvn verify -Dcleanup -Dmidpoint.home=/home/midpoint/schrodinger -Dserver.port=8181

Test run with external Tomcat

If you want to run Schrodinger Tests against your external midPoint instance, follow this setup (let's assume default run):

  • specify correct URL in schrodinger.properties: base_url=http://localhost:8080/midpoint
  • change port in testing/schrodingertest/pom.xml: <server.port>8080</server.port>

Troubleshooting

Symptom

Test run ends on message "Midpoint 4.0.1-SNAPSHOT booting up for integration testing, embedded Tomcat instance configured to listen on port: 8180:" with no further progress.

Solution

Embedded Tomcat didn't start. Run midPoint on your own Tomcat and set enviroment as in "Test run with external Tomcat".

Symptom

Tests timeouts with something like:

Timeout: 6 s.
Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@data-s-resource-key='PageAdmin.menu.top.configuration']"}

Solution

Run Tomcat with this parameter:

set JAVA_OPTS=-Dmidpoint.schrodinger=true

Test coverage

TODO

...

Integration with an automation server (Jenkins)

TODO

...

Further framework extension

TODO

...

Adding custom test suites 

The execution of test suites is orchestrated via the maven failsafe plugin. To add additional test cases to the suite execution you will need to modify the suite configuration file. 

Defaults

By default, the information of which test classes are the subject of execution is present in the "testng-integration-schrodinger.xml" suite configuration file at the root of the "schrodingertest" module.

If you would like to change the name or path to the suite configuration file, this change has to be done in the project POM file of the "schrodingertest" module. The configuration is present in the plugin with the artifact "maven-failsafe-plugin".

<suiteXmlFiles>
    <suiteXmlFile>testng-integration-schrodinger.xml</suiteXmlFile>
</suiteXmlFiles>


...


  • No labels