Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: adding notes on how to run web tests in JUnit

...

The maven test profile is used to configure maven to use /src/test/resources to look for additional properties and make sure that it runs properly. It runs in a clean crowd instance and ensures that jetty runs on a different port.

Running WebITCase tests against an alternate tDAR instance using JUnit

One of the drawbacks to running the web tests using verify goal is that you don't have visibility to the local jetty instance's log messages.  You can get around this by running the web tests in JUnit, however, you'll first need to instruct the webtests to connect to a different server (since the test jetty instance will not be created).  There are a couple ways to go about this...

Option 1 - Running the web tests against to a stand-alone instance of tDAR

  1. modify the following values in TestConstants.java
    1. DEFAULT_BASE_URL  - e.g. "http://alpha.tdar.org:".  Don't forget the colon.
    2. DEFAULT_PORT - e.g. "8080"  
    3. USERNAME - change to a known account on the standalone instance.
    4. PASSWORD 
    5. ADMIN_USERNAME - change to a known admin-level- account on the standalone instance
    6. ADMIN_PASSWORD 
  2. Run the test using JUnit  instead of via the maven verify goal

Option 2 - Running the web tests against a stand-alone test jetty instance

Similar to above, instead of modifying the test constants you modify the web app config to run a standalone instance of the test version of your web app. 

  • Modify /src/main/resources/hibernate.properties to specify the test database (i.e copy/paste the values from src/test/resources/hibernate.properties)
  • Modify /src/main/resources/crowd.properties to specify the test authentication host
  • Do one of the following (but not both) 
    • change jetty port in pom.xml from 8080 to 8180, -OR-
    • change the DEAULT_PORT in TdarConstants.java to connect to 8080 instead of 8180.

Writing Tests in tDAR

Starting Points

...