~~ Licensed to the Apache Software Foundation (ASF) under one or more ~~ contributor license agreements. See the NOTICE file distributed with ~~ this work for additional information regarding copyright ownership. ~~ The ASF licenses this file to You under the Apache License, Version 2.0 ~~ (the "License"); you may not use this file except in compliance with ~~ the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, software ~~ distributed under the License is distributed on an "AS IS" BASIS, ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~~ See the License for the specific language governing permissions and ~~ limitations under the License. ------ Howto create tests for Tobago Demo 3.0 or higher ------ Howto create QUnit tests for Tobago Demo 3.0 or higher [[1]] Choose a \.xhtml file for testing. [[2]] Create a \.test.js file (with same name). [[3]] Add a {{{http://api.qunitjs.com/QUnit.test/}QUnit test}} to the \.test.js. +---------------------------------------- QUnit.test("Testtitle", function(assert) { ... }); +---------------------------------------- [[a]] The test will run in a different frame. To get an element in the test frame use <<>> instead of <<>>. [[b]] To wait for a submit use <<>>. [[c]] To wait for an AJAX event use <<>>. The function <<>> must return false if still waiting and true if the waiting is done. The function <<>> is executed afterwards. [[4]] Add the test to QUnitTests. +---------------------------------------- @Test public void testname() throws UnsupportedEncodingException, InterruptedException { String page = "content/.../testname.xhtml"; runStandardTest(page); } +---------------------------------------- [[5]] Run the tests from QUnitTests or type +---------------------------------------- mvn verify -Pqunit-integration-tests +----------------------------------------