View Javadoc

1   /*
2    * Copyright 2007 united internet (unitedinternet.com) Robert Zimmermann
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *
16   */
17  package com.unitedinternet.portal.selenium.utils.logging;
18  
19  import com.thoughtworks.selenium.Selenium;
20  
21  /**
22   * Extends Selenium with ability to log comments and write the log.
23   *
24   * @author Robert Zimmermann
25   *
26   * $Id: LoggingSelenium.java 111 2008-04-18 15:21:02Z ralf2511 $
27   */
28  public interface LoggingSelenium extends Selenium {
29      /**
30       * Extension of Selenium to provide ability to log comments.
31       *
32       * @param comment the comment to be handled by the used formatter
33       */
34      void logComment(final String comment);
35  
36      /**
37       * Take a screen shot and write the location to the log.
38       *
39       * Will be used in case of an error (thrown exception).
40       *
41       * @param baseName middle part of the generated filename. can be extended (with e.g. a timestamp) by the used
42       *        LoggingResultsFormatter.
43       */
44      void logAutomaticScreenshot(final String baseName);
45  
46      /**
47       * Log an assertion.
48       *
49       * Needed by LoggingAssert class, which wraps junit4 assertions.
50       *
51       * @param assertionName Name of the thrown assertion
52       * @param assertionMessage Message of the thrown assertion
53       * @param assertionCondition Failed condition which led to this assertion.
54       */
55      void logAssertion(final String assertionName, final String assertionMessage, final String assertionCondition);
56  
57      /**
58       * Log an resource (binary) file. Normally use in case of error to add
59       * screen shot or more informations about test conditions to the log.
60       *
61       * @param description A text that describes the reource
62       * @param pathFile Full path and file to the resource
63       */
64      void logResource(final String description, final String pathFile);
65  }