Skip to content

Faker Actions related to Country

capital

Description: This function will generate a random capital city

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 capital DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random capital city", input = InputType.YES, condition = InputType.NO)
    public void capital() {
        try {
            String strObj = Input;
            String capital = faker.get(key).country().capital();
            Report.updateTestLog(Action, "Generated data: " + capital, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, capital);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

countryCode2

Description: This function will generate a random 2-letter country code

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 countryCode2 DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random 2-letter country code", input = InputType.YES, condition = InputType.NO)
    public void countryCode2() {
        try {
            String strObj = Input;
            String countryCode2 = faker.get(key).country().countryCode2();
            Report.updateTestLog(Action, "Generated data: " + countryCode2, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, countryCode2);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

countryCode3

Description: This function will generate a random 3-letter country code

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 countryCode3 DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random 3-letter country code", input = InputType.YES, condition = InputType.NO)
    public void countryCode3() {
        try {
            String strObj = Input;
            String countryCode3 = faker.get(key).country().countryCode3();
            Report.updateTestLog(Action, "Generated data: " + countryCode3, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, countryCode3);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

countryCurrency

Description: This function will generate a random currency name

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 countryCurrency DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random currency name", input = InputType.YES, condition = InputType.NO)
    public void countryCurrency() {
        try {
            String strObj = Input;
            String currency = faker.get(key).country().currency();
            Report.updateTestLog(Action, "Generated data: " + currency, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, currency);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

countryCurrencyCode

Description: This function will generate a random currency code

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 countryCurrencyCode DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random currency code", input = InputType.YES, condition = InputType.NO)
    public void countryCurrencyCode() {
        try {
            String strObj = Input;
            String currencyCode = faker.get(key).country().currencyCode();
            Report.updateTestLog(Action, "Generated data: " + currencyCode, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, currencyCode);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

flag

Description: This function will generate a random country flag

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 flag DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random country flag", input = InputType.YES, condition = InputType.NO)
    public void flag() {
        try {
            String strObj = Input;
            String flag = faker.get(key).country().flag();
            Report.updateTestLog(Action, "Generated data: " + flag, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, flag);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }

countryName

Description: This function will generate a random country name

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 countryName DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random country name", input = InputType.YES, condition = InputType.NO)
    public void countryName() {
        try {
            String strObj = Input;
            String name = faker.get(key).country().name();
            Report.updateTestLog(Action, "Generated data: " + name, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, name);
        } catch (Exception ex) {
            Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "Exception during data generation", ex);
            Report.updateTestLog(Action, "Error generating data: " + "\n" + ex.getMessage(), Status.DEBUG);
        }
    }