001/**
002 * Powerunit - A JDK1.8 test framework
003 * Copyright (C) 2014 Mathieu Boretti.
004 *
005 * This file is part of Powerunit
006 *
007 * Powerunit is free software: you can redistribute it and/or modify
008 * it under the terms of the GNU General Public License as published by
009 * the Free Software Foundation, either version 3 of the License, or
010 * (at your option) any later version.
011 *
012 * Powerunit is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015 * GNU General Public License for more details.
016 *
017 * You should have received a copy of the GNU General Public License
018 * along with Powerunit. If not, see <http://www.gnu.org/licenses/>.
019 */
020package ch.powerunit;
021
022/**
023 * Test result listener.
024 *
025 * @author borettim
026 * @param <T>
027 *            Test type
028 */
029public interface TestResultListener<T> {
030
031    /**
032     * String used a groups parameter when the test doesn't belong to any
033     * groups.
034     */
035    String ALL_GROUPS = "<none>";
036
037    /**
038     * Notification of the start of a set of test.
039     * 
040     * @param setName
041     *            the setName
042     * @param groups
043     *            the groups {@link Categories}
044     */
045    void notifySetStart(String setName, String groups);
046
047    /**
048     * Notification of the end of a set of test.
049     * 
050     * @param setName
051     *            the setName
052     * @param groups
053     *            the groups {@link Categories}
054     */
055    void notifySetEnd(String setName, String groups);
056
057    /**
058     * Notification of the start of one single test.
059     * 
060     * @param context
061     *            the context
062     */
063    void notifyStart(TestContext<T> context);
064
065    /**
066     * Notification of the end (success) of one single test.
067     * 
068     * @param context
069     *            the context
070     */
071    void notifySuccess(TestContext<T> context);
072
073    /**
074     * Notification of the end (failure) of one single test.
075     * 
076     * @param context
077     *            the context
078     * @param cause
079     *            the cause of the failure
080     */
081    void notifyFailure(TestContext<T> context, Throwable cause);
082
083    /**
084     * Notification of the end (error) of one single test.
085     * 
086     * @param context
087     *            the context
088     * @param cause
089     *            the cause of the error
090     */
091    void notifyError(TestContext<T> context, Throwable cause);
092
093    /**
094     * Notification of the end (skipped) of one single test.
095     * 
096     * @param context
097     *            the context
098     */
099    void notifySkipped(TestContext<T> context);
100
101    /**
102     * Notification of the start of the tests for one parameter. Ignore for non
103     * parameter test.
104     * 
105     * @param setName
106     *            the Set name.
107     * @param parameterName
108     *            the Parameter name.
109     */
110    void notifyParameterStart(String setName, String parameterName);
111
112    /**
113     * Notification of the end of the tests for one parameter. Ignore for non
114     * parameter test.
115     * 
116     * @param setName
117     *            the Set name.
118     * @param parameterName
119     *            the Parameter name.
120     */
121    void notifyParameterEnd(String setName, String parameterName);
122
123}