module ExpectoLogging
open Expecto
open Expecto.Logging
open Expecto.Logging.Message
let logger = Log.create "Logger"
[<Tests>]
let tests =
testList
"all tests"
([ 1..10 ]
|> List.map (fun i ->
testCase $"failing test {i}" (fun () ->
logger.info (eventX "Info from test before {testNumber}" >> setField "testNumber" i)
Expect.isFalse true "Expected false")))
[<EntryPoint>]
let main argv =
Tests.runTestsInAssemblyWithCLIArgs [] argv
I was expecting that logs from assertions and my custom logs would be grouped together and the order would be preserved,
that is having 3 tests:
"a"-> which logs "x" and then fails on assertion,
"b" -> which logs "y" and then fails on assertion,
"c" -> which logs "z" and then fails on assertion
expected output would be something like
-----test "a"------
"x"
Expected false
-----test "c"------
"z"
Expected false
----- test "b"------
"y"
Expected false
However, my custom logs in output are disconnected from its wrapping testCase - they are not grouped.
I'm not sure if I have missed something in documentation and this should be done differently to make it working.
Do you have any hints how could I achieve this behaviour?
Hi, following steps specified in section about test parallelism https://github.com/haf/expecto#about-test-parallelism I've created a few tests with logging inside to check how logging behaves.
I was expecting that logs from assertions and my custom logs would be grouped together and the order would be preserved, that is having 3 tests: "a"-> which logs "x" and then fails on assertion, "b" -> which logs "y" and then fails on assertion, "c" -> which logs "z" and then fails on assertion expected output would be something like -----test "a"------ "x" Expected false
-----test "c"------ "z" Expected false
----- test "b"------ "y" Expected false
However, my custom logs in output are disconnected from its wrapping testCase - they are not grouped.![image](https://github.com/haf/expecto/assets/22114978/b7900369-43f9-455f-9457-811d3abf08e3)
I'm not sure if I have missed something in documentation and this should be done differently to make it working. Do you have any hints how could I achieve this behaviour?