assertTrue
public static void assertTrue(String message, boolean condition)
-
Asserts that a condition is true. If it isn't it throws an
AssertionErrorwith the given message.分析:
示例:
boolean value=webDriver.findElement(By.xpath("......")).isDisplay();//判斷是否顯示xx
assertTrue("Failed to go to the Login page", value);
如果value的值是true則運行成功,如果value的值是false則運行失敗並打印出信息“Failed to go to the Login page”。
-
- Parameters:
-
message- the identifying message for theAssertionError(nullokay) -
condition- condition to be checked
assertTrue
public static void assertTrue(boolean condition)
-
Asserts that a condition is true. If it isn't it throws an
AssertionErrorwithout a message. -
- Parameters:
-
condition- condition to be checked
