Class AllureThreadContext

java.lang.Object
io.qameta.allure.internal.AllureThreadContext

public class AllureThreadContext extends Object
Thread-local binding for the current Allure execution context.
  • Constructor Details

    • AllureThreadContext

      public AllureThreadContext()
  • Method Details

    • getCurrent

      public Optional<AllureExternalKey> getCurrent()
      Returns last (most recent) key.
    • getRoot

      public Optional<AllureExternalKey> getRoot()
      Returns first (oldest) key.
    • getCurrentStep

      public Optional<AllureExternalKey> getCurrentStep()
      Returns the current step key, that is the current key unless it is the root test or fixture. Empty when no step is running above the root.
    • getCurrentExecutable

      public Optional<AllureExternalKey> getCurrentExecutable()
      Returns the executable key new executable items should be attached to.
    • getLocalKeys

      public List<AllureExternalKey> getLocalKeys()
      Returns a snapshot of the current binding's locally bound keys, most recent first.
      Returns:
      local keys, top of the stack first
    • start

      public void start(AllureExternalKey key)
      Adds new key.
    • copy

      public AllureExecutionContext copy()
      Returns a copy of the current thread context.
      Returns:
      context snapshot
    • get

      public AllureExecutionContext get()
      Returns the current execution context.
      Returns:
      current execution context
    • set

      public void set(AllureExecutionContext executionContext)
      Restores the current thread context binding from a snapshot.
      Parameters:
      executionContext - the context snapshot
    • push

      public void push(AllureExecutionContext executionContext)
      Adds execution context binding to the current thread.
      Parameters:
      executionContext - the context to bind
    • pushBinding

      public AllureThreadBinding pushBinding(AllureExecutionContext executionContext)
      Adds execution context binding to the current thread and returns a handle for removing that exact binding.
      Parameters:
      executionContext - the context to bind
      Returns:
      a binding that removes this exact context when closed, including when another thread closes it
    • pop

      Removes latest execution context binding. Ignores base context.
      Returns:
      removed execution context.
    • stop

      public Optional<AllureExternalKey> stop()
      Removes latest added key. Ignores empty context.
      Returns:
      removed key.
    • clear

      public void clear()
      Removes all the data stored for current thread.