Interface AssertionContext

All Known Implementing Classes:
QtafCucumberHooks, QtafTestNGContext

public interface AssertionContext
This interface contains all assertions QTAF supports natively.
  • Method Details

    • getLogCollection

      TestScenarioLogCollection getLogCollection()
      Returns the collection containing all scenario logs.
      Returns:
      the scenario log collection
    • getNoMessageString

      default String getNoMessageString()
      Get a string that will be set as the logging message when no logging message is given by the test case.
      Returns:
      default log message
    • assertTrue

      default void assertTrue(boolean condition, String message)
      Assert that a condition is true.
      Parameters:
      condition - The condition
      message - The message that should be displayed if the assertion fails
    • assertTrue

      default void assertTrue(boolean condition, String message, boolean continueOnFailure)
      Assert that a condition is true.
      Parameters:
      condition - The condition
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertFalse

      default void assertFalse(boolean condition, String message)
      Assert that a condition is false.
      Parameters:
      condition - The condition
      message - The message that should be displayed if the assertion fails
    • assertFalse

      default void assertFalse(boolean condition, String message, boolean continueOnFailure)
      Assert that a condition is false.
      Parameters:
      condition - The condition
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNull

      default void assertNull(Object object)
      Assert that an object is null.
      Parameters:
      object - The object
    • assertNull

      default void assertNull(Object object, String message)
      Assert that an object is null.
      Parameters:
      object - The object
      message - The message that should be displayed if the assertion fails
    • assertNull

      default void assertNull(Object object, String message, boolean continueOnFailure)
      Assert that an object is null.
      Parameters:
      object - The object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNotNull

      default void assertNotNull(Object object)
      Assert that an object is not null.
      Parameters:
      object - The object
    • assertNotNull

      default void assertNotNull(Object object, String message)
      Assert that an object is not null.
      Parameters:
      object - The object
      message - The message that should be displayed if the assertion fails
    • assertNotNull

      default void assertNotNull(Object object, String message, boolean continueOnFailure)
      Assert that an object is not null.
      Parameters:
      object - The object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertSame

      default void assertSame(Object actual, Object expected)
      Asserts that two objects refer to the same object.
      Parameters:
      actual - Actual object
      expected - Expected object
    • assertSame

      default void assertSame(Object actual, Object expected, String message)
      Asserts that two objects refer to the same object.
      Parameters:
      actual - Actual object
      expected - Expected object
      message - The message that should be displayed if the assertion fails
    • assertSame

      default void assertSame(Object object, Object expected, String message, boolean continueOnFailure)
      Assert that two objects refer to the same object.
      Parameters:
      object - Actual object
      expected - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNotSame

      default void assertNotSame(Object actual, Object expected)
      Asserts that two objects do not refer to the same objects.
      Parameters:
      actual - Actual object
      expected - Expected object
    • assertNotSame

      default void assertNotSame(Object actual, Object expected, String message)
      Asserts that two objects do not refer to the same objects.
      Parameters:
      actual - Actual object
      expected - Expected object
      message - The message that should be displayed if the assertion fails
    • assertNotSame

      default void assertNotSame(Object object, Object expected, String message, boolean continueOnFailure)
      Assert that two objects do not refer to the same object.
      Parameters:
      object - Actual object
      expected - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertEquals

      default void assertEquals(Object object1, Object object2)
      Checks if two objects are equal.
      Parameters:
      object1 - The first object
      object2 - The second object
    • assertEquals

      default void assertEquals(Object object1, Object object2, String message)
      Checks if two objects are equal.
      Parameters:
      object1 - The first object
      object2 - The second object
      message - The message that should be displayed if the assertion fails
    • assertEquals

      default void assertEquals(Object object1, Object object2, String message, boolean continueOnFailure)
      Checks if two objects are equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertEqualsDeep

      default void assertEqualsDeep(Set<?> actual, Set<?> expected)
      Checks if two sets are deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
    • assertEqualsDeep

      default void assertEqualsDeep(Set<?> actual, Set<?> expected, String message)
      Checks if two sets are deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
      message - The message that should be displayed if the assertion fails
    • assertEqualsDeep

      default void assertEqualsDeep(Map<?,?> actual, Map<?,?> expected)
      Checks if two maps are deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
    • assertEqualsDeep

      default void assertEqualsDeep(Map<?,?> actual, Map<?,?> expected, String message)
      Checks if two maps are deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
      message - The message that should be displayed if the assertion fails
    • assertEqualsDeep

      default void assertEqualsDeep(Map<?,?> object1, Map<?,?> object2, String message, boolean continueOnFailure)
      Checks if two objects are equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertEqualsDeep

      default void assertEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure)
      Checks if two objects are equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Set<?> actual, Set<?> expected)
      Checks if two sets are not deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Set<?> actual, Set<?> expected, String message)
      Checks if two sets are not deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
      message - The message that should be displayed if the assertion fails
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Map<?,?> actual, Map<?,?> expected)
      Checks if two maps are not deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Map<?,?> actual, Map<?,?> expected, String message)
      Checks if two maps are not deeply equal.
      Parameters:
      actual - The first object
      expected - The second object
      message - The message that should be displayed if the assertion fails
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Map<?,?> object1, Map<?,?> object2, String message, boolean continueOnFailure)
      Checks if two objects are not deeply equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNotEqualsDeep

      default void assertNotEqualsDeep(Set<?> object1, Set<?> object2, String message, boolean continueOnFailure)
      Checks if two objects are not deeply equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertEqualsNoOrder

      default void assertEqualsNoOrder(Object[] object1, Object[] object2)
      Asserts that two arrays contain the same elements in no particular order.
      Parameters:
      object1 - The first object
      object2 - The second object
    • assertEqualsNoOrder

      default void assertEqualsNoOrder(Object[] object1, Object[] object2, String message)
      Asserts that two arrays contain the same elements in no particular order.
      Parameters:
      object1 - The first object
      object2 - The second object
      message - The message that should be displayed if the assertion fails
    • assertEqualsNoOrder

      default void assertEqualsNoOrder(Object[] object1, Object[] object2, String message, boolean continueOnFailure)
      Asserts that two arrays contain the same elements in no particular order.
      Parameters:
      object1 - The first object
      object2 - The second object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • assertNotEquals

      default void assertNotEquals(Object object1, Object object2)
      Checks if two objects are not equal.
      Parameters:
      object1 - The first object
      object2 - The second object
    • assertNotEquals

      default void assertNotEquals(Object object1, Object object2, String message)
      Checks if two objects are not equal.
      Parameters:
      object1 - The first object
      object2 - The second object
      message - The message that should be displayed if the assertion fails
    • assertNotEquals

      default void assertNotEquals(Object object1, Object object2, String message, boolean continueOnFailure)
      Checks if two objects are not equal.
      Parameters:
      object1 - Actual object
      object2 - Expected object
      message - The message that should be displayed if the assertion fails
      continueOnFailure - Should the assertion stop the test case on failure?
    • buildAssertionLogMessage

      default AssertionLogMessage buildAssertionLogMessage(StepInformationLogMessage stepLog, String message)
      Create a new assertion log message object.
      Parameters:
      stepLog - step log that belongs to the assertion log
      message - assertion message
      Returns:
      assertion log object
    • handleAssertCondition

      default void handleAssertCondition(AssertionLogMessageType type, boolean condition, String message, AssertionError error)
      Handle condition assertions.
      Parameters:
      type - assertion type
      condition - condition that should be tested
      message - assertion message
      error - assertion error
    • handleAssertCondition

      default void handleAssertCondition(AssertionLogMessageType type, Object object, String message, AssertionError error)
      Handle condition assertions.
      Parameters:
      type - assertion type
      object - object that should be tested
      message - assertion message
      error - assertion error
    • handleAssertCondition

      default void handleAssertCondition(AssertionLogMessageType type, Object object, Object expected, String message, AssertionError error)
      Handle condition assertions.
      Parameters:
      type - assertion type
      object - object that should be tested
      expected - object that was expected
      message - assertion message
      error - assertion error
    • handleAssertTrue

      default void handleAssertTrue(boolean condition, String message, AssertionError error)
      Handle assertTrue method call.
      Parameters:
      condition - condition that should be tested
      message - assertion message
      error - assertion error
    • handleAssertFalse

      default void handleAssertFalse(boolean condition, String message, AssertionError error)
      Handle assertFalse method call.
      Parameters:
      condition - condition that should be tested
      message - assertion message
      error - assertion error
    • handleAssertNull

      default void handleAssertNull(Object object, String message, AssertionError error)
      Handle assertNull method call.
      Parameters:
      object - object that should be tested
      message - assertion message
      error - assertion error
    • handleAssertNotNull

      default void handleAssertNotNull(Object object, String message, AssertionError error)
      Handle assertNull method call.
      Parameters:
      object - object that should be tested
      message - assertion message
      error - assertion error
    • handleAssertSame

      default void handleAssertSame(Object object, Object expected, String message, AssertionError error)
      Handle assertSame method call.
      Parameters:
      object - object that should be tested
      expected - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertNotSame

      default void handleAssertNotSame(Object object, Object expected, String message, AssertionError error)
      Handle assertNotSame method call.
      Parameters:
      object - object that should be tested
      expected - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertEquals

      default void handleAssertEquals(Object object1, Object object2, String message, AssertionError error)
      Handle assertEquals method call.
      Parameters:
      object1 - object that should be tested
      object2 - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertNotEquals

      default void handleAssertNotEquals(Object object1, Object object2, String message, AssertionError error)
      Handle assertNotEquals method call.
      Parameters:
      object1 - object that should be tested
      object2 - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertEqualsDeep

      default void handleAssertEqualsDeep(Object object1, Object object2, String message, AssertionError error)
      Handle assertDeepEquals method call.
      Parameters:
      object1 - object that should be tested
      object2 - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertNotEqualsDeep

      default void handleAssertNotEqualsDeep(Object object1, Object object2, String message, AssertionError error)
      Handle assertNotEqualsDeep method call.
      Parameters:
      object1 - object that should be tested
      object2 - object that is expected to be equal
      message - assertion message
      error - assertion error
    • handleAssertEqualsNoOrder

      default void handleAssertEqualsNoOrder(Object[] object1, Object[] object2, String message, AssertionError error)
      Handle assertEqualsNoOrder method call.
      Parameters:
      object1 - object that should be tested
      object2 - object that is expected to be equal
      message - assertion message
      error - assertion error