5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * The contents of this file are subject to the terms
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * of the Common Development and Distribution License
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * (the License). You may not use this file except in
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * compliance with the License.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * You can obtain a copy of the License at
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * See the License for the specific language governing
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * permission and limitations under the License.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * When distributing Covered Code, include this CDDL
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Header Notice in each file and include the License file
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * If applicable, add the following below the CDDL Header,
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * with the fields enclosed by brackets [] replaced by
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * your own identifying information:
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * $Id: Test.java,v 1.2 2008/06/25 05:53:06 qcheng Exp $
23e304384f98fca4ab2e6f9f07a53465c1bfc645Peter Major * Portions Copyrighted 2012 ForgeRock Inc
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Fosterimport javax.xml.parsers.ParserConfigurationException;
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * This class is the test object in the report generating tool setup.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * It is responsible for capturing the attributes of a test and then
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * generate HTML markup accordingly.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster private List<TestCase> testcases = new ArrayList<TestCase>();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Creates an instance of <code>Test</code>.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @throws ParserConfigurationException if the <code>testNG</code>
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * report XML is not well formed.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @throws SAXException if the <code>testNG</code> report XML is not
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * well formed.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @throws IOException if the <code>testNG</code> report XML is not
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * accessible.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster throws ParserConfigurationException, SAXException, IOException {
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Returns <code>true</code> if the testcase succeeded.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @return <code>true</code> if the testcase succeeded.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Returns a list of passed testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @return list of passed testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster List<TestCase> passed = new ArrayList<TestCase>();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Returns a list of skipped testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @return list of skipped testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster List<TestCase> skipped = new ArrayList<TestCase>();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Returns a list of failed testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @return list of failed testcases.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster List<TestCase> failed = new ArrayList<TestCase>();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * Returns HTML markup for this object.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster * @return HTML markup for this object.
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster List<TestCase> skipped = getSkippedTestCases();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster return MessageFormat.format(HTMLConstants.TEST_TABLE, params);
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster throws ParserConfigurationException, SAXException, IOException
23e304384f98fca4ab2e6f9f07a53465c1bfc645Peter Major DocumentBuilder builder = XMLUtils.getSafeDocumentBuilder(false);
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster numberOfTests = Integer.parseInt(topElement.getAttribute("tests"));
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster numberOfFailures = Integer.parseInt(topElement.getAttribute(
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster "failures"));
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster numberOfErrors = Integer.parseInt(topElement.getAttribute("errors"));
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster timeTaken = Float.parseFloat(topElement.getAttribute("time"));
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster NodeList childElements = topElement.getChildNodes();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster int numChildElements = childElements.getLength();
5c099afa7c9361afc2f4477fec0e3018588d7840Allan Foster if ((node != null) && (node.getNodeType() == Node.ELEMENT_NODE)) {