Create Test Plans
Example Prompt:
Example Response:
Related Tasks:
Develop Automated Test Scripts
Example Prompt:
Example Response:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.junit.Assert;
public class LoginTest {
public static void main(String[] args) {
// Set the path for the ChromeDriver
System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
WebDriver driver = new ChromeDriver();
try {
// Step 1: Navigate to the login page
driver.get("http://example.com/login");
// Step 2: Enter valid username and password
WebElement usernameField = driver.findElement(By.id("username"));
usernameField.sendKeys("validUsername");
WebElement passwordField = driver.findElement(By.id("password"));
passwordField.sendKeys("validPassword");
// Step 3: Click the login button
WebElement loginButton = driver.findElement(By.id("loginButton"));
loginButton.click();
// Step 4: Verify redirection to the dashboard
String expectedUrl = "http://example.com/dashboard";
String actualUrl = driver.getCurrentUrl();
Assert.assertEquals(expectedUrl, actualUrl);
System.out.println("Login test passed!");
} catch (Exception e) {
e.printStackTrace();
} finally {
// Close the browser
driver.quit();
}
}
}
Related Tasks:
Execute Automated Tests
Example Prompt:
Example Response:
Related Tasks:
Log and Track Defects
Example Prompt:
Example Response:
Related Tasks:
Review and Optimize Testing Processes
Example Prompt:
Example Response:
Related Tasks: