Closed mohamedMahameed closed 6 years ago
i has finished to build the automatic end to end tests template and i have wrote some tests for example and now we can test our controller as we want. this is tutorials i have used to achieve that : http://www.baeldung.com/integration-testing-in-spring https://docs.spring.io/spring-security/site/docs/current/reference/html/test-mockmvc.html https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html#boot-features-testing-spring-boot-applications-testing-autoconfigured-tests
I found this code for how to test a REST controller : this code tests a small web application which returns greeting to the user when he goes to the path "\" .
` @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @DirtiesContext public class HelloWorldConfigurationTests {
} `
you have to import all the needed classes , and small google search explains each class and function very well . I think our basic tests should go like in the code above.