SELENIUM : What is Hard Assert in TestNG? SDET Automation Testing Interview Questions & Answers
Автор: SDET Automation Testing Interview Pro
Загружено: 2023-02-04
Просмотров: 793
Описание:
👉 Crack SDET QA Interviews with a Powerful Self-Introduction 👉 https://topmate.io/qa_sdet_automation...
👉 Top 50 SDET Behavioral Interview Questions & Answers 👉 https://topmate.io/qa_sdet_automation...
Level up your SDET and QA skills! 🚀 SELENIUM : What is Hard Assert in TestNG?
SDET Automation Testing Interview Questions & Answers
We will be covering a wide range of topics including QA manual testing, automation testing, Selenium, Java, Jenkins, Cucumber, Maven, and various testing frameworks.
What is Hard Assert in TestNG?
In TestNG, assertions are used to verify that a test case is behaving as expected. There are two types of assertions: hard assertions and soft assertions.
A hard assertion in TestNG is an assertion that stops the test case immediately if it fails. This means that if a hard assertion fails, the test case will stop executing further and move on to the next test case.
Here's an example of a hard assertion:
@Test
public void testAddition() {
int num1 = 10;
int num2 = 20;
int sum = num1 + num2;
Assert.assertEquals(sum, 30);
}
In the above example, the assertEquals method is a hard assertion. If the sum of num1 and num2 is not equal to 30, the assertion will fail and the test case will stop executing immediately.
Hard assertions are useful for verifying critical functionality or for situations where the test case cannot continue if a particular condition is not met. However, it is important to use them judiciously, as they can lead to false negatives if the assertion fails due to unexpected conditions, such as environmental issues.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: