Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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

  1. modify the following values in TestConstants.javaDEFAULT_BASE_URL  - In your JUnit run configuration, add the following system properties (e.g -Duser.pass="foobar")
    1. tdar.baseurl (e.g. -Dtdar.baseurl="http://alpha.tdar.org:80"

      .  Don't forget the colon.DEFAULT_PORT -

      )

    2. tdar.user (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 
    7. -Dtdar.user="test@tdar.org")
    8. tdar.pass(e.g. -Dtdar.pass="test")
  2. Run the test using JUnit  instead instead of via the maven verify goal

...

  • 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.In the JUnit run configuration, add the following system property:
    • -Dtdar.baseurl="http://localhost:8080"

Writing Tests in tDAR

Starting Points

Rebuilding the test database

...

(updating src/test/db/init-

...

db.sql

...

):

By default, running the full integration test will reset and rebuild the test database.  However, just after a release, or after a major schema change is made (often when data is removed or moved) it may be necessary to rebuild the script that populates the test database. This can be done with the following process:

  1. drop your local development tdarmetadata database and recreate it from tdarmetadata.zipapply all schema changes in
  2. run src/main/db/upgrade-db.sql (remember to add schema changes to upgrade-db.sql first!)run load_tdarmetadata_database.sh to reinitialize your database with the appropriate test data
  3. run mvn -PsqlExtract initialize compile exec:java
  4. this should rebuild src/test/db/init-test.sql based on src/test/db/extractRecords.sql
  5. refresh the mercurial tree and then commit changes
Note

extractRecords.sql should only need to be modified when there are significant changes to the schema (e.g., consolidating tables or other table-level changes, or adding new test data, new resource ids, etc.)

 

Integration Testing

Tests involving database transactions

...