org.easetech.easytest.util
Class DataContext

java.lang.Object
  extended by org.easetech.easytest.util.DataContext

public final class DataContext
extends Object

Data Context Holder for the test data and the corresponding test method. This is an internal class that

Author:
Anuj Kumar

Field Summary
static ThreadLocal<Map<String,List<Map<String,Object>>>> convertedDataThreadLocal
          DataContext thread local variable that will hold the data for easy consumption by the test cases.
static ThreadLocal<Map<String,List<Map<String,Object>>>> dataContextThreadLocal
          DataContext thread local variable that will hold the data for easy consumption by the test cases.
static ThreadLocal<String> nameContextThreadLocal
          Test Method Name Context thread local variable that will hold the name of the test method currently executing.
 
Method Summary
static void clearConvertedData()
          Clears the data
static void clearData()
          Clears the data
static void clearNameData()
          Clears the data
static Map<String,List<Map<String,Object>>> getConvertedData()
          Returns the data.
static Map<String,List<Map<String,Object>>> getData()
          Returns the data Look at setData(Map) for details of the content in the returned map.
static String getMethodName()
           
static void setConvertedData(Map<String,List<Map<String,Object>>> data)
          Sets the converted Data.
static void setData(Map<String,List<Map<String,Object>>> data)
          Sets the Data.
static void setMethodName(String name)
          Sets the data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

convertedDataThreadLocal

public static final ThreadLocal<Map<String,List<Map<String,Object>>>> convertedDataThreadLocal
DataContext thread local variable that will hold the data for easy consumption by the test cases. Look at setConvertedData(Map) for details.


dataContextThreadLocal

public static final ThreadLocal<Map<String,List<Map<String,Object>>>> dataContextThreadLocal
DataContext thread local variable that will hold the data for easy consumption by the test cases. Look at setData(Map) for details.


nameContextThreadLocal

public static final ThreadLocal<String> nameContextThreadLocal
Test Method Name Context thread local variable that will hold the name of the test method currently executing.

Method Detail

setData

public static void setData(Map<String,List<Map<String,Object>>> data)
Sets the Data. The data in this set is of the form :

org.easetech.easytest.example.TestExcelDataLoader:getExcelTestDataWithDouble=[{libraryId=0009, itemId=0008}]
where :

setConvertedData

public static void setConvertedData(Map<String,List<Map<String,Object>>> data)
Sets the converted Data. The data in this set is of the form :

org.easetech.easytest.example.TestExcelDataLoader:getExcelTestDataWithDouble{libraryId=0009, itemId=0008}=[{libraryId=0009, itemId=0008}]
where :
  • org.easetech.easytest.example.TestExcelDataLoader : is the name of the TestClass
  • getExcelTestDataWithDouble{libraryId=0009, itemId=0008} : is the name of the Test Method to run along with the data that it will be run with
  • [{libraryId=0009, itemId=0008}] : is the actual array of test data

    Parameters:
    data - the test data in the form :

    Map<MethodName , List<Map<ParamName , ParamValue>>

    If we take the above example, then it is constructed like this:

    Map<String,Object> attributeData = new HashMap<String,Object>();
    attributeData.put("libraryId",0009);
    attributeData.put("itemId",0008);
    Map<String,List<Map<String,Object>> actualData = new HashMap<String,List<Map<String,Object>>();
    actualData.put("org.easetech.easytest.example.TestExcelDataLoader:getExcelTestDataWithDouble{libraryId=0009, itemId=0008}" , Collections.singletonList(attributeData));

getConvertedData

public static Map<String,List<Map<String,Object>>> getConvertedData()
Returns the data. Look at setConvertedData(Map) for details of the content in the returned map.

Returns:
The data

getData

public static Map<String,List<Map<String,Object>>> getData()
Returns the data Look at setData(Map) for details of the content in the returned map.

Returns:
The data

clearData

public static void clearData()
Clears the data


clearConvertedData

public static void clearConvertedData()
Clears the data


getMethodName

public static String getMethodName()

setMethodName

public static void setMethodName(String name)
Sets the data

Parameters:
name - to set

clearNameData

public static void clearNameData()
Clears the data



Copyright © 2013. All Rights Reserved.