mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-30 11:17:54 +08:00
6a02870926
* [Feature][style] Add spotless maven plugin for automatic style fix (#10963) * Fix spotless ratchet configuration * Remove license-check and decrease line length threshold value * Update related docs * Remove checkstyle and add pre-commit hook * Test updated pre-commit hook * Replace checkstyle with spotless in CI * Remove reviewdog |
||
---|---|---|
.. | ||
dolphinscheduler-api-test-case | ||
dolphinscheduler-api-test-core | ||
lombok.config | ||
pom.xml | ||
README.md |
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 {
}