test: Integration tests outline
This commit is contained in:
parent
2f7e706548
commit
2981691ffc
6 changed files with 191 additions and 2 deletions
|
@ -0,0 +1,131 @@
|
|||
package eu.ztsh.wymiana.web;
|
||||
|
||||
import eu.ztsh.wymiana.WireMockExtension;
|
||||
import org.junit.jupiter.api.ClassOrderer;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.MethodOrderer;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestClassOrder;
|
||||
import org.junit.jupiter.api.TestMethodOrder;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* Integration test suite.
|
||||
* Contrary to the principle of test independence, tests are dependent on one another to create continuous suite.
|
||||
*/
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@ActiveProfiles("it")
|
||||
@ExtendWith(WireMockExtension.class)
|
||||
@TestMethodOrder(MethodOrderer.DisplayName.class)
|
||||
@TestClassOrder(ClassOrderer.DisplayName.class)
|
||||
class ApplicationIntegrationTests {
|
||||
|
||||
private final WebTestClient webTestClient;
|
||||
|
||||
@Autowired
|
||||
public ApplicationIntegrationTests(WebTestClient webTestClient) {
|
||||
this.webTestClient = webTestClient;
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMethodOrder(MethodOrderer.DisplayName.class)
|
||||
@DisplayName("01: Context")
|
||||
class ContextTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("01.1: Load context")
|
||||
void contextLoads() {
|
||||
assertThat(webTestClient).isNotNull();
|
||||
webTestClient.get().uri("/actuator/health").exchange().expectBody().json("{\"status\":\"UP\"}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMethodOrder(MethodOrderer.DisplayName.class)
|
||||
@DisplayName("02: User")
|
||||
class UserTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("02.1: Create valid user")
|
||||
void createUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("02.2: Try to create invalid user")
|
||||
void createInvalidUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("02.3: Try to create duplicated user")
|
||||
void createDuplicatedUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("02.4: Get valid user")
|
||||
void getValidUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("02.5: Try to get non-existing user")
|
||||
void getNonExistingUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("02.6: Get user by incorrect PESEL")
|
||||
void getIncorrectPeselUserTest() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMethodOrder(MethodOrderer.DisplayName.class)
|
||||
@DisplayName("03: Exchange")
|
||||
class ExchangeTests {
|
||||
|
||||
@Test
|
||||
@DisplayName("03.1: Try to perform invalid money exchange: no data")
|
||||
void noNbpDataTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("03.2: Perform valid money exchange")
|
||||
void exchangeTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("03.3: Try to perform invalid money exchange: not existing user")
|
||||
void exchangeNotExistingUserTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("03.4: Try to perform invalid money exchange: invalid PESEL")
|
||||
void invalidPeselTest() {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("03.5: Try to perform invalid money exchange: insufficient funds")
|
||||
void insufficientFundsTest() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue