Package org.easetech.easytest.util

Examples of org.easetech.easytest.util.TestInfo


        List<TestInfo> testInfoList = new ArrayList<TestInfo>();

        // populateTestInfo(testInfo);
        // THere would always be atleast one method associated with the Runner, else validation would fail.
        for (FrameworkMethod method : testMethods) {
            TestInfo testInfo = null;

            // Only if the return type of the Method is not VOID, we try to determine the right loader and data
            // files.
            DataLoader loaderAnnotation = method.getAnnotation(DataLoader.class);
            if (loaderAnnotation != null) {
                testInfo = DataLoaderUtil.determineLoader(loaderAnnotation, getTestClass());

            } else {
                loaderAnnotation = getTestClass().getJavaClass().getAnnotation(DataLoader.class);
                if (loaderAnnotation != null) {
                    testInfo = DataLoaderUtil.determineLoader(loaderAnnotation, getTestClass());
                }
            }
            if (testInfo != null) {
                testInfo.setMethodName(method.getName());
                testInfoList.add(testInfo);
            }

        }
       
View Full Code Here


     *
     * @return {@link TestInfo} an instance of {@link TestInfo} containing information about the currently executing
     *         test.
     */
    public static TestInfo determineLoader(DataLoader testData, TestClass testClass) {
        TestInfo result = new TestInfo(testClass);
        // String[] dataFiles = testData.filePaths();
        String[] dataFiles = determineFilePaths(testData);
        LoaderType loaderType = determineLoaderType(testData, dataFiles);
        // Loader
        Loader dataLoader = null;
        if (LoaderType.CUSTOM.equals(loaderType) || dataFiles.length == 0) {
            dataLoader = getCustomLoaderInstance(testData);
        } else {
            // user has specified data files and the data fileType is also
            // not custom.
            if (loaderType != null) {
                dataLoader = LoaderFactory.getLoader(loaderType);
            }

        }
        result.setDataLoader(dataLoader);
        result.setFilePaths(dataFiles);
        result.setWriteData(testData.writeData());
        return result;
    }
View Full Code Here

            testData = testClass.getAnnotation(DataLoader.class);
        } else {
            testData = method.getAnnotation(DataLoader.class);
        }
        if (testData != null) {
            TestInfo testInfo = DataLoaderUtil.determineLoader(testData, currentTestClass);
            Loader dataLoader = testInfo.getDataLoader();
            if (testInfo.getDataLoader() == null) {
                Assert.fail("The framework currently does not support the specified Loader type. "
                    + "You can provide the custom Loader by choosing LoaderType.CUSTOM in TestData "
                    + "annotation and providing your custom loader using DataLoader annotation.");
            } else {
                if (testInfo.getFilePaths() == null || testInfo.getFilePaths().length == 0) {
                    // implies that there exists a CUSTOM loader that loads the data using Java classes
                    Map<String, List<Map<String, Object>>> data = dataLoader.loadData(new EmptyResource());
                    // We also maintain the copy of the actual data for our write functionality.
                    fillWritableData(writableData , data , testData.appendData());
                    DataContext.setData(DataConverter.appendClassName(data, currentTestClass.getJavaClass()), testData.appendData());
                    DataContext.setConvertedData(DataConverter.convert(data, currentTestClass.getJavaClass()) , testData.appendData());
                } else {
                    ResourceLoader resourceLoader = new ResourceLoaderStrategy(currentTestClass.getJavaClass());
                    for (String filePath : testInfo.getFilePaths()) {
                        Resource resource = resourceLoader.getResource(filePath);
                        try {
                            if (resource.exists()) {
                                Map<String, List<Map<String, Object>>> data = dataLoader.loadData(resource);
                                // We also maintain the copy of the actual data for our write functionality.
View Full Code Here

TOP

Related Classes of org.easetech.easytest.util.TestInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.