org.tap4j.ext.testng
Class TestNGTapUtils

Package class diagram package TestNGTapUtils
java.lang.Object
  extended by org.tap4j.ext.testng.TestNGTapUtils

public final class TestNGTapUtils
extends Object

Utility class with methods to support TAP generation with TestNG.

Since:
1.1

Field Summary
static Comparator<org.testng.ITestResult> EXECUTION_DATE_COMPARATOR
          A constant that defines a comparator for TestNG TestResults.
 
Method Summary
static void addAll(org.testng.internal.ResultMap total, org.testng.IResultMap map)
          Adds all ITestResult's inside the map object inside the total one.
static void createTestNGYAMLishData(TestResult testResult, org.testng.ITestResult testNgTestResult)
           Inserts TestNG YAMLish diagnostic information into a TAP TestResult.
static void createYAMLishActualAndExpected(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishBacktrace(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishDatetime(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishDisplay(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishDump(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishError(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishExtensions(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
          Creates YAMLish diagnostic extensions entry data.
static void createYAMLishFile(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishLine(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishMessage(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishName(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishSeverity(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void createYAMLishSource(Map<String,Object> yamlish, org.testng.ITestResult testNgTestResult)
           
static void fillAttributes(org.testng.ITestResult tr, org.testng.ITestContext ctx)
          Fills the TestNG Attributes from the context into the TestNG Test Result.
static TestResult generateTAPTestResult(org.testng.ITestResult testResult, Integer number)
          Generates a TAP TestResult from a given TestNG TestResult.
static String generateTAPTestResultDescription(org.testng.ITestResult testResult)
          Generates a TAP TestResult description with full qualified class name concatenated with the character '#' and the test method.
static List<org.testng.ITestResult> getTestNGResultsOrderedByExecutionDate(org.testng.ITestContext testContext)
          Return an ordered list of TestNG TestResult from a given TestNG Test Context.
static List<org.testng.ITestResult> getTestNGResultsOrderedByExecutionDate(org.testng.internal.ResultMap total)
          Return an ordered list of TestNG TestResult from a given TestNG Test Context.
static void setTapTestResultStatus(TestResult tapTestResult, int status)
          Sets the StatusValue into a TAP TestResult.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXECUTION_DATE_COMPARATOR

public static final Comparator<org.testng.ITestResult> EXECUTION_DATE_COMPARATOR
A constant that defines a comparator for TestNG TestResults. This comparator returns the TestNG TestResults ordered by execution date. For example, if the test A ran at 08:00 and the test B ran at 07:00, it will say that the correct order for these elements is [B, A].

Method Detail

generateTAPTestResult

public static TestResult generateTAPTestResult(org.testng.ITestResult testResult,
                                               Integer number)
Generates a TAP TestResult from a given TestNG TestResult.

Parameters:
testResult - TestNG Test Result
number - TAP Test Number
Returns:
TAP TestResult

generateTAPTestResultDescription

public static String generateTAPTestResultDescription(org.testng.ITestResult testResult)
Generates a TAP TestResult description with full qualified class name concatenated with the character '#' and the test method.

Parameters:
testResult - TestNG TestResult
Returns:
Name of TAP Test Result

setTapTestResultStatus

public static void setTapTestResultStatus(TestResult tapTestResult,
                                          int status)
Sets the StatusValue into a TAP TestResult. In cases where the StatusValue is equal SKIP a Directive is also created and added to the TAP Test Result.

Parameters:
tapTestResult - TAP TestResult
status - TestNG Test Status (Success, Skip, or any other that is treated as Failed in TAP)

createTestNGYAMLishData

public static void createTestNGYAMLishData(TestResult testResult,
                                           org.testng.ITestResult testNgTestResult)

Inserts TestNG YAMLish diagnostic information into a TAP TestResult.

For more about TAP YAMLish diagnostic read this Wiki.

Parameters:
testResult - TAP TestResult
testNgTestResult - TestNG TestResult

createYAMLishMessage

public static void createYAMLishMessage(Map<String,Object> yamlish,
                                        org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishSeverity

public static void createYAMLishSeverity(Map<String,Object> yamlish,
                                         org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishSource

public static void createYAMLishSource(Map<String,Object> yamlish,
                                       org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishDatetime

public static void createYAMLishDatetime(Map<String,Object> yamlish,
                                         org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishFile

public static void createYAMLishFile(Map<String,Object> yamlish,
                                     org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishLine

public static void createYAMLishLine(Map<String,Object> yamlish,
                                     org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishName

public static void createYAMLishName(Map<String,Object> yamlish,
                                     org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishExtensions

public static void createYAMLishExtensions(Map<String,Object> yamlish,
                                           org.testng.ITestResult testNgTestResult)
Creates YAMLish diagnostic extensions entry data.

Parameters:
yamlish - YAMLish Map
testNgTestResult - TestNG TestResult

createYAMLishActualAndExpected

public static void createYAMLishActualAndExpected(Map<String,Object> yamlish,
                                                  org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishDisplay

public static void createYAMLishDisplay(Map<String,Object> yamlish,
                                        org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishDump

public static void createYAMLishDump(Map<String,Object> yamlish,
                                     org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishError

public static void createYAMLishError(Map<String,Object> yamlish,
                                      org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

createYAMLishBacktrace

public static void createYAMLishBacktrace(Map<String,Object> yamlish,
                                          org.testng.ITestResult testNgTestResult)
Parameters:
yamlish -
testNgTestResult -

getTestNGResultsOrderedByExecutionDate

public static List<org.testng.ITestResult> getTestNGResultsOrderedByExecutionDate(org.testng.ITestContext testContext)
Return an ordered list of TestNG TestResult from a given TestNG Test Context.

Parameters:
testContext - TestNG Test Context
Returns:
Ordered list of TestNG TestResults

getTestNGResultsOrderedByExecutionDate

public static List<org.testng.ITestResult> getTestNGResultsOrderedByExecutionDate(org.testng.internal.ResultMap total)
Return an ordered list of TestNG TestResult from a given TestNG Test Context.

Parameters:
total - TestNG Result Map
Returns:
Ordered list of TestNG TestResults

addAll

public static void addAll(org.testng.internal.ResultMap total,
                          org.testng.IResultMap map)
Adds all ITestResult's inside the map object inside the total one.

Parameters:
total - ResultMap that holds the total of IResultMap's.
map - An IResultMap object.

fillAttributes

public static void fillAttributes(org.testng.ITestResult tr,
                                  org.testng.ITestContext ctx)
Fills the TestNG Attributes from the context into the TestNG Test Result.

Parameters:
tr -
ctx -


Copyright © 2010-2012 TupiLabs. All Rights Reserved.