001    /*
002     * Created on May 6, 2007
003     * 
004     * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005     * in compliance with the License. You may obtain a copy of the License at
006     * 
007     * http://www.apache.org/licenses/LICENSE-2.0
008     * 
009     * Unless required by applicable law or agreed to in writing, software distributed under the License
010     * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011     * or implied. See the License for the specific language governing permissions and limitations under
012     * the License.
013     * 
014     * Copyright @2007-2009  the original author or authors.
015     */
016    package org.fest.swing.testng.listener;
017    
018    import org.testng.ITestContext;
019    import org.testng.ITestListener;
020    import org.testng.ITestResult;
021    
022    /**
023     * Understands a base class for TestNG listeners.
024     *
025     * @author Alex Ruiz
026     */
027    public abstract class AbstractTestListener implements ITestListener {
028    
029      /**
030       * Invoked after the test class is instantiated and before any configuration method is called.
031       * @param context test context containing all the information for a given test run.
032       */
033      public void onStart(ITestContext context) {}
034      
035      /**
036       * Invoked after all the tests have run and all their Configuration methods have been called.
037       * @param context test context containing all the information for a given test run.
038       */
039      public void onFinish(ITestContext context) {}
040    
041      /**
042       * Invoked each time a method fails but has been annotated with successPercentage and this failure still keeps it
043       * within the success percentage requested.
044       * @param result contains information about the run test.
045       */
046      public void onTestFailedButWithinSuccessPercentage(ITestResult result) {}
047    
048      /**
049       * Invoked each time before a test will be invoked. The <code>{@link ITestResult}</code> is only partially filled
050       * with the references to class, method, start millis and status.
051       * @param result the partially filled test result.
052       */
053      public void onTestStart(ITestResult result) {}
054      
055      /**
056       * Invoked each time a test succeeds.
057       * @param result contains information about the run test.
058       */
059      public void onTestSuccess(ITestResult result) {}
060      
061      /**
062       * Invoked each time a test fails.
063       * @param result contains information about the run test.
064       */
065      public void onTestFailure(ITestResult result) {}
066    
067      /**
068       * Invoked each time a test is skipped.
069       * @param result contains information about the run test.
070       */
071      public void onTestSkipped(ITestResult result) {}
072    }