org.easetech.easytest.loader
Class DataLoaderUtil

java.lang.Object
  extended by org.easetech.easytest.loader.DataLoaderUtil

public final class DataLoaderUtil
extends Object

A Utility class for loading test data. This class has methods to identify information about loading the data

Author:
Anuj Kumar

Field Summary
protected static org.slf4j.Logger LOG
          An instance of logger associated with the test framework.
 
Constructor Summary
DataLoaderUtil()
           
 
Method Summary
static TestInfo determineLoader(DataLoader testData, org.junit.runners.model.TestClass testClass)
          Method that determines the right Loader and the right Data Files for the "write output data" functionality supported by the EasyTest Framework.
static boolean isMethodDataLoaded(String methodName)
          Check if the data for the given method is loaded or not.
static void loadData(Class<?> testClass, org.junit.runners.model.FrameworkMethod method, org.junit.runners.model.TestClass currentTestClass, Map<String,List<Map<String,Object>>> writableData)
          Load the Data for the given class or method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.slf4j.Logger LOG
An instance of logger associated with the test framework.

Constructor Detail

DataLoaderUtil

public DataLoaderUtil()
Method Detail

determineLoader

public static TestInfo determineLoader(DataLoader testData,
                                       org.junit.runners.model.TestClass testClass)
Method that determines the right Loader and the right Data Files for the "write output data" functionality supported by the EasyTest Framework.

Parameters:
testData - an instance of DataLoader that helps in identifying the right Loader to write the data back to the file.
testClass - the class that the TestInfo object will be associated with
Returns:
TestInfo an instance of TestInfo containing information about the currently executing test.

loadData

public static void loadData(Class<?> testClass,
                            org.junit.runners.model.FrameworkMethod method,
                            org.junit.runners.model.TestClass currentTestClass,
                            Map<String,List<Map<String,Object>>> writableData)
Load the Data for the given class or method. This method will try to find DataLoader on either the class level or the method level. In case the annotation is found, this method will load the data using the specified loader class and then save it in the DataContext for further use by the system. We also create another copy of the input test data that we store in the BaseSuite.writableData field. This is done in order to facilitate the writing of the data that might be returned by the test method.

Parameters:
testClass - the class object, if any.
method - current executing method, if any.
currentTestClass - the currently executing test class. this is used to append in front of the method name to get unique method names as there could be methods in different classes with the same name and thus we want to avoid conflicts.
writableData - The writable data that is used internally for reporting purposes

isMethodDataLoaded

public static boolean isMethodDataLoaded(String methodName)
Check if the data for the given method is loaded or not.

Parameters:
methodName - the name of the method whose data needs to be checked.
Returns:
true if there exists data for the given method, else false.


Copyright © 2013. All Rights Reserved.