How do we write Selenium Test cases?
Автор: G C Reddy Software Testing
Загружено: 2021-06-13
Просмотров: 901
Описание:
https://www.gcreddy.com/2021/06/how-w...
How do we write Selenium Test cases?
1. Selecting Manual Test Cases
2. Web or HTML Element Locators
3. Selenium WebDriver Methods
4. Programming (Java) Concepts
5 Testing Framework (TestNG) concepts
Automated a Manual Test case using Selenium
a. Manual Test Case
Test case name: Verify Admin Login functionality in gcrShop application Admin interface
Test steps:
Test Steps:
1. Launch Browser
2. Navigate to "https://gcreddy.com/project/admin/log..."
3. Enter Username
4. Enter Password
5. Click the "Login" Button
6. Return the displayed status of the "Logoff" link
7. Close the Browser window
Input/Test Data:
1. Username: gcreddy
2. Password: Temp@2020
Verification point:
Verify the existence of the "Logoff" link after clicking on the ‘Login’ button.
Expected: Availability of "Logoff" Link
Actual Result: *After Test Case Execution
Test Result: Pass/Fail (*After Test Case Execution)
Comments:
Elements involved in thiis functionality (navigation)
1. Username – Edit box – name() – "username"
2. Password – Edit box – name() – "password"
3. Login – Button – id() – "tdb1"
4. Logoff – Link linkText() – "Logoff"
Required Selenium WebDriver Methods for this functionality:
Navigate to gcrShop application admin interface home page – get("URL")
Enter a value into "Username" Edit box – sendKeys("value")
Enter a value into "Password" Edit box – sendKeys("value")
Click "Login" Button – click()
Return a Link displayed status – isDisplayed()
Java Programming:
We use Java programming syntax to write the test case (ex: every test step should end with a semicolon and statements are case sensitive, etc,)
We use Java Data type and variable to return the "Logoff" link displayed status.
TestNG Testing Framework
We use the TestNG framework ‘Assert’ methods to insert verification point/s and generating test reports.
Selenium Test Case:
@Test
public void verifyAdminLogin() {
driver.get("https://gcreddy.com/project/admin/log...");
driver.findElement(By.name("username")).sendKeys("gcreddy");
driver.findElement(By.name("password")).sendKeys("Temp@2020");
driver.findElement(By.id("tdb1")).click();
Thread.sleep(3000);
boolean status = driver.findElement(By.linkText("Logoff")).click;
Assert.assertEquals(status , true);
driver.close();
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: