Skip to content

Faker Actions related to Book

bookTitle

Description: This function will generate a random book title

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 bookTitle DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random book title", input = InputType.YES, condition = InputType.NO)
    public void bookTitle() {
        try {
            String strObj = Input;
            String bookTitle = faker.get(key).book().title();
            Report.updateTestLog(Action, "Generated data: " + bookTitle, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, bookTitle);
        } 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);
        }
    }

bookAuthor

Description: This function will generate a random book author

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 bookAuthor DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random book author", input = InputType.YES, condition = InputType.NO)
    public void bookAuthor() {
        try {
            String strObj = Input;
            String bookAuthor = faker.get(key).book().author();
            Report.updateTestLog(Action, "Generated data: " + bookAuthor, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, bookAuthor);
        } 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);
        }
    }

bookGenre

Description: This function will generate a random book genre

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 bookGenre DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random book genre", input = InputType.YES, condition = InputType.NO)
    public void bookGenre() {
        try {
            String strObj = Input;
            String bookGenre = faker.get(key).book().genre();
            Report.updateTestLog(Action, "Generated data: " + bookGenre, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, bookGenre);
        } 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);
        }
    }

bookPublisher

Description: This function will generate a random book publisher

Input Format : DatasheetName:ColumnName

ObjectName Action Input Condition Reference
Synthetic Data 🟢 bookPublisher DatasheetName:ColumnName ⬅ Store in Datasheet
@Action(object = ObjectType.FAKER, desc = "Generate a random book publisher", input = InputType.YES, condition = InputType.NO)
    public void bookPublisher() {
        try {
            String strObj = Input;
            String bookPublisher = faker.get(key).book().publisher();
            Report.updateTestLog(Action, "Generated data: " + bookPublisher, Status.DONE);
            String sheetName = strObj.split(":", 2)[0];
            String columnName = strObj.split(":", 2)[1];
            userData.putData(sheetName, columnName, bookPublisher);
        } 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);
        }
    }