All Downloads are FREE. Search and download functionalities are using the official Maven repository.

automated.core.annotations.AttributesConfig Maven / Gradle / Ivy

The newest version!
package automated.core.annotations;

/**
 * Created by Ismail on 4/3/2018.
 * This Class used to retrieve annotations values related to test level
 * or method level on current runtime as defined in current test case
 * and globalize these values for any class call defined methods here
 * This class won't check if attribute has a value or not, so you need
 * to be sure value of the attribute is well defined and provided
 */
public class AttributesConfig {

    // This method to retrieve current value of locators file
    // You need to pass a ClassAttributes object
    public String getLocatorsFile(ClassAttributes classAttributes) {
        // Verify if Locators File attribute not null to return it's value
        // else return an empty string
        return classAttributes.LocatorsFile() != null ? classAttributes.LocatorsFile() : "";
    }

    // This method to retrieve current value of data file
    // You need to pass a ClassAttributes object
    public String getDataFile(ClassAttributes classAttributes) {
        // Verify if data File attribute not null to return it's value
        // else return an empty string
        return classAttributes.DataFile() != null ? classAttributes.DataFile() : "";
    }

    // This method to retrieve current value of BaseURL
    // You need to pass a ClassAttributes object
    public String getBaseURL(ClassAttributes classAttributes) {
        // Verify if BaseURL attribute not null to return it's value
        // else return an empty string
        return classAttributes.BaseURL() != null ? classAttributes.BaseURL() : "";
    }

    // This method to retrieve current value of data row
    // You need to pass a MethodAttributes object
    public int getDataRow(MethodAttributes methodAttributes) {
        // Decrease 1 cause reading files starts from zero
        // so in this case will make QA able to start rows starts from 1
        return (methodAttributes.DataRow() - 1);
    }

    // This method to retrieve current value of data columns
    // You need to pass a MethodAttributes object
    public int[] getDataColumns(MethodAttributes methodAttributes) {
        return methodAttributes.DataColumns();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy