Search Results for

    Show / Hide Table of Contents

    Akka.TestKit Configuration

    Below is the default HOCON configuration for the base Akka.TestKit package.

    ######################################
    # Akka Testkit Reference Config File #
    ######################################
    
    # This is the reference config file that contains all the default settings.
    
    akka {
        # Replace the default value, ["Akka.Event.DefaultLogger"], with TestEventListener
        # This logger behaves exactly like DefaultLogger, but makes it possible
        # to use EventFiltering. If no filter is specified it logs to StdOut just like
        # DefaultLogger.
      loggers = ["Akka.TestKit.TestEventListener, Akka.TestKit"]
      test {
        # factor by which to scale timeouts during tests, e.g. to account for shared
        # build system load
        timefactor =  1.0
    
        # duration of EventFilter.intercept waits after the block is finished until
        # all required messages are received
        filter-leeway = 3s
    
        # duration to wait in expectMsg and friends outside of within() block
        # by default
        single-expect-default = 3s
    
        # The timeout that is added as an implicit by DefaultTimeout trait 
        # This is used for Ask-pattern
        default-timeout = 5s
        
        # The amount of time it takes the testkit to startup
        # Increase this value if you're running many tests in parallel
        startup-timeout = 5s
    
        calling-thread-dispatcher {
          type = "Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"
          throughput = 2147483647
        }
    
        test-actor.dispatcher {
          type = "Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"
          throughput = 2147483647
        }
    
        # Disable batching in order to prevent flakiness with Akka.Remote tests (since they have low message frequency)
        remote.dot-netty.tcp.batching.enabled = false
      }
    }
    

    Additionally, it's also possible to change the default IScheduler implementation in the Akka.TestKit to use a virtualized TestScheduler implementation that Akka.NET developers can use to artificially advance time forward. To swap in the TestScheduler, developers will want to include the HOCON below:

    ######################################
    # Akka Testkit Reference Config File #
    ######################################
    
    # This is the reference config file that contains all the default settings.
    
    akka {
        # Replace the default value, ["Akka.Event.DefaultLogger"], with TestEventListener
        # This logger behaves exactly like DefaultLogger, but makes it possible
        # to use EventFiltering. If no filter is specified it logs to StdOut just like
        # DefaultLogger.
      loggers = ["Akka.TestKit.TestEventListener, Akka.TestKit"]  
    
      scheduler {
        implementation = "Akka.TestKit.TestScheduler, Akka.TestKit" 
      }
    
      test {
        # factor by which to scale timeouts during tests, e.g. to account for shared
        # build system load
        timefactor =  1.0
    
        # duration of EventFilter.intercept waits after the block is finished until
        # all required messages are received
        filter-leeway = 3s
    
        # duration to wait in expectMsg and friends outside of within() block
        # by default
        single-expect-default = 3s
    
        # The timeout that is added as an implicit by DefaultTimeout trait 
        # This is used for Ask-pattern
        default-timeout = 5s
     
    
        calling-thread-dispatcher {
          type = "Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"
          throughput = 2147483647
        }
    
        test-actor.dispatcher {
          type = "Akka.TestKit.CallingThreadDispatcherConfigurator, Akka.TestKit"
          throughput = 2147483647
        }
      }
    }
    
    In this article
    • githubEdit this page
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET