binzunu1909 / ui-test-selenium

Testing on Web API server about School Management
1 stars 0 forks source link

[Test] Useful Tools, Plugins, etc. #15

Open Bisllly opened 1 year ago

Bisllly commented 1 year ago

1. Lombok

Auto-generated getters, setters, constructors and more... https://projectlombok.org/features/

Example:

use @Getter, @Setter, and @Constructor to implicitly generate getters, setter and constructor:

package student.student_add_test.entity;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
public class Student {
    String firstName;
    String lastName;
    String email;
}

result: able to use getter, setter and constructor without having them in entity:

    @Before
    public void setUp() {
        student = new Student("Chilll", "Braauoo", "bingchilling@gmail.com"); //constructor
    }
    @Test
    public void testAddStudent() {
        Enter.theValue(student.getFirstName()).into(StudentUI.INPUT_ID_FIRST_NAME);                     //getter
        createStudentPage.fillLastName(StudentUI.INPUT_ID_LAST_NAME, student.getLastName());
        createStudentPage.fillEmail(StudentUI.INPUT_ID_EMAIL, student.getEmail());
    }
Bisllly commented 1 year ago

Lombok @Builder annotation

https://www.baeldung.com/lombok-builder

Builder Generator

https://plugins.jetbrains.com/plugin/6585-builder-generator