DolphinScheduler/dolphinscheduler-api-test
2024-02-05 17:14:59 +08:00
..
dolphinscheduler-api-test-case fix: data quality may fail in docker mode (#15563) 2024-02-05 17:14:59 +08:00
dolphinscheduler-api-test-core [Improvement][API Test] Add API test cases for process definition controller (#14300) 2023-07-06 13:17:13 +08:00
pom.xml [CI] Try fix api test error (#14094) 2023-05-12 21:39:00 +08:00
README.md [Improvement][API-Test] Add api tests for project page (#14402) 2023-06-27 10:00:11 +08:00

DolphinScheduler Backend API Test

Page Object Model

DolphinScheduler API test respects the Page Object Model (POM) design pattern. Every page of DolphinScheduler's api is abstracted into a class for better maintainability.

Example

The login page's api is abstracted as LoginPage , with the following fields,

public HttpResponse login(String username, String password) {
    Map<String, Object> params = new HashMap<>();

    params.put("userName", username);
    params.put("userPassword", password);

    RequestClient requestClient = new RequestClient();

    return requestClient.post("/login", null, params);
}

where userName, userPassword are the main elements on UI that we are interested in.

Test Environment Setup

DolphinScheduler API test uses testcontainers to set up the testing environment, with docker compose.

Typically, every test case needs one or more docker-compose.yaml files to set up all needed components, and expose the DolphinScheduler UI port for testing. You can use @DolphinScheduler(composeFiles = "") and pass the docker-compose.yaml files to automatically set up the environment in the test class.


@DolphinScheduler(composeFiles = "docker/tenant/docker-compose.yaml")
class TenantAPITest {
}