Program-38
@RunWith([Link])
@SpringBootTest
public class FrontendApplicationTest {
@Autowired
private TestRestTemplate restTemplate;
@Test
public void testIndexPage() {
ResponseEntity<String> response = [Link]("/", [Link]);
assertEquals([Link], [Link]());
assertTrue([Link]().contains("Welcome to the Frontend Application"));
}
@Test
public void testAboutPage() {
ResponseEntity<String> response = [Link]("/about", [Link]);
assertEquals([Link], [Link]());
assertTrue([Link]().contains("About Us"));
}
}
<dependency>
<groupId>[Link]</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
@RunWith([Link])
@SpringBootTest
public class FrontendApplicationTest {
@Autowired
private WebApplicationContext context;
private WebDriver driver;
@Before
public void setup() {
driver = new ChromeDriver();
}
@Test
public void testIndexPage() {
[Link]("http:
assertTrue([Link]().contains("//localhost:8080/");
assertTrue([Link]().contains("Frontend Application"));
}
@Test
public void testAboutPage() {
[Link]("testAboutPage() {
[Link]("[Link]
assertTrue([Link]().contains("About Us"));
}
@After
public void tearDown() {
[Link]();
}
}
<dependency>
<groupId>[Link]</groupId>
<artifactId>selenium-java</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>[Link]</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<scope>test</scope>
</dependency>
@RunWith([Link])
public class FrontendApplicationTest {
@Given("^I navigate to the index page$")
public void navigateToIndexPage() {
[Link]("http:
}
@Then("//localhost:8080/");
}
@Then("^I should see the title \"([^\"]*)\"$")
public void verifyTitle(String title) {
assertTrue([Link]().contains(title));
}
}