Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced logs for successful scenarios [Console Reporter] #1654

Open
jotacoroe2y opened this issue Apr 18, 2023 · 12 comments
Open

Reduced logs for successful scenarios [Console Reporter] #1654

jotacoroe2y opened this issue Apr 18, 2023 · 12 comments
Labels

Comments

@jotacoroe2y
Copy link

It would be nice to have a configuration property to hide steps logs in successful scenarios:

if (!(outcome instanceof ExecutionSuccessful)) {
        this.printScene(event.sceneId);
      } else if (shouldLogSuccessScenarios) {
        logSuccessScenariosMode === 'full'
          ? this.printScene(event.sceneId)
          : this.printSuccessScene(event.sceneId);
      }

Inside the ConsoleReporter class. We tried to implement it but most of the stuff is private.
However, it works fine in runtime:
image

@jan-molak jan-molak added @serenity-js/console-reporter enhancement A good idea that should be implemented labels Apr 18, 2023
@jan-molak
Copy link
Member

jan-molak commented Apr 18, 2023

Ha! Funny you should mention that; I was thinking about this very thing recently.

I wrote the current (and fairly verbose) console reporter when Serenity/JS supported only Protractor. Protractor supported only one reporter at the time, so printing each Serenity/JS task as they were completed provided a nice real-time view of scenario progress.

However, things have moved on since then.

Both WebdriverIO and Playwright Test support multiple reporters, they also apply similar tactics to avoid having them write all over each other's console output - they buffer the complete log per reporter and then print it out when the whole test suite is finished. Unfortunately, this means that real-time reporting is no longer possible, and also if your test suite has hundreds or thousands of tests - when the test suite completes, you get swamped with console output.

I wonder if a better way to approach this could be to provide a high-level summary of all the executed scenarios (grouped by file to make navigation easier), then followed by a detailed report of any failures that might have occurred.

So something perhaps like this:

Scenarios                                                                 Line      Total Time    Result
-------------------------------------------------------------------------------------------------------------------
spec/manage_a_todo_list.spec.ts
  ✓ Managing a Todo List: TodoMVC actor records new items                 18        1s 382ms      Success             # totals per scenario
  ✗ Managing a Todo List: TodoMVC actor removes the recorded items        25        619ms         Assertion error     # maybe errors should link to the interaction that failed?

spec/completing-items.spec.ts
  ✓ Managing a Todo List: TodoMVC actor marks an item as completed        9         384ms

Failures                                                                  Line      Total Time    Result
-------------------------------------------------------------------------------------------------------------------
spec/manage_a_todo_list.spec.ts

  ✗ Managing a Todo List: TodoMVC actor removes the recorded items        25        619ms         Assertion error

    Wendy starts with a list containing 1 items
      Wendy starts with an empty list
        ✓ Wendy navigates to '/' (43ms)
        ✓ Wendy ensures that <<current page>>.title() does end with 'Serenity/JS TodoApp' (5ms)
      Wendy adds an item called "Walk a dog"
        ✓ Wendy waits until "What needs to be done?" input box does become clickable (128ms)
        ✓ Wendy enters 'Walk a dog' into "What needs to be done?" input box (15ms)
        ✓ Wendy presses key Enter in "What needs to be done?" input box (14ms)
    Wendy removes an item called "Walk a dog"
      ✓ Wendy hovers the mouse over item called 'Walk a dog' (174ms)
      ✓ Wendy clicks on destroy button of item called 'Walk a dog' (58ms)
    ✗ Wendy ensures that the number of list of items does equal 0 (3ms)
      ✓ Wendy executes a synchronous script (3ms)

    ✗ Execution failed with assertion error (829ms)

      AssertionError: Expected the number of list of items to equal 0

      Expectation: equals(1)

      Expected number: 0
      Received number: 1

What do you think?

I also wonder if we could use hyperlinks to navigate from the scenario result to its file system location.

CC: @viper3400

Potentially related: #18

@maxe2y
Copy link

maxe2y commented Apr 19, 2023

I also wonder if we could use hyperlinks to navigate from the scenario result to its file system location.

this would be awesome

@jotacoroe2y
Copy link
Author

Hi @jan-molak, what a coincidence haha. Thanks for your answer. Some thoughts:

  • Related to how the logs are printed: real time logs are really nice to have when executing tests in your local machine. It's a pity that for the moment we cannot have this functionality.
  • About how the information is distributed: the approach you propose is awesome.

I also wonder if we could use hyperlinks to navigate from the scenario result to its file system location.

Maybe to have the hyperlink to the scenario in the Line column?

Also, if errors in the Result column redirect to the concrete interaction that have failed as you say, that would be really nice too.

@jan-molak
Copy link
Member

jan-molak commented Apr 19, 2023

I had a little play with the idea of using hyperlinks last night, but it doesn't seem to be supported consistently across terminals...

However, file://<absolute path> seems to be supported across the popular IDEs (JetBrains, VSCode, possibly others), and CI servers tend to support hyperlinks 🤔

So, thinking aloud, given I have a project checked out locally at:

/Users/jan/Projects/serenity-js/

And the code is stored in a repository that's available via a web UI:

https://github.com/serenity-js/serenity-js/blob/<branch or commit>/<path>?plain=1#L<line number>`

I could point to a specific file and line:

  • locally, using an absolute path, e.g. file:///Users/jan/Projects/serenity-js/README.md:48
  • on CI, using a hyperlink to a specific commit
    • GitHub: e.g. https://github.com/serenity-js/serenity-js/blob/e1ae560fbe8475a37a5761cdd123891a0471aa8a/README.md?plain=1#L48
    • GitLab: e.g. https://gitlab.com/serenity-js/serenity-js/-/blob/e1ae560fbe8475a37a5761cdd123891a0471aa8a/README.md#L48

Now, since absolute paths are much longer than just the few digits of the line number, perhaps the console reporter should print something like this instead:

Summary                                         Time           Result            Location
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Managing a Todo List
  ✓ TodoMVC actor records new items             1s 382ms      Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:18
  ✗ TodoMVC actor removes the recorded items    619ms         AssertionError    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:25

Managing a Todo List
  ✓ TodoMVC actor marks an item as completed    384ms         Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/completing-items.spec.ts:9

Details                                                                                            Time    Location
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Managing a Todo List

  ✗ TodoMVC actor removes the recorded items                                                        619ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:25

    Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
        ✓ Wendy navigates to '/'                                                                    43ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:10
        ✓ Wendy ensures that <<current page>>.title() does end with 'Serenity/JS TodoApp'           5ms     file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:12
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
        ✓ Wendy waits until "What needs to be done?" input box does become clickable                128ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:9
        ✓ Wendy enters 'Walk a dog' into "What needs to be done?" input box                         15ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:10
        ✓ Wendy presses key Enter in "What needs to be done?" input box                             14ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:11
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
      ✓ Wendy hovers the mouse over item called 'Walk a dog'                                        174ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:9
      ✓ Wendy clicks on destroy button of item called 'Walk a dog'                                  58ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:10
    ✗ Wendy ensures that the number of list of items does equal 0                                   182ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:29

    ✗ Execution failed with assertion error

      AssertionError: Expected the number of list of items to equal 0

      Expectation: equals(1)

      Expected number: 0
      Received number: 1

We could probably have the Location pattern configurable and expressed like https://github.com/serenity-js/serenity-js/blob/{path}?plain=1#L{line_number} or something like this.


One case we haven't discussed yet is when you've just started working on a test scenario and actually do want to see all the details.

It almost feels like the console reporter should be printing two reports:

  • Scenario summary - a list of scenarios with high-level status
  • Scenario details - activity-by-activity report, which could be configured to show either all activities for all scenarios or only the failed ones

Which perhaps could be configured like this 🤔:

crew: [
  [ '@serenity-js/console-reporter', { 
      theme: 'auto',
      locationPattern: `${process.cwd()}/{path}:{line_number}`,
      reports: [
        [ 'summary' ]
        [ 'details', { threshold: 'failure' } ], // maybe a configurable outcome threshold for the detailed report?
      ]
  } ]                
]

@maxe2y
Copy link

maxe2y commented Apr 25, 2023

{ threshold: 'failure' } 💯

@damonpam
Copy link
Contributor

damonpam commented Apr 26, 2023

What about having different levels for the details? Also, distinguish between the failure and all. For example, using cucumber:

reports: [
    [ 'details', { onlyFailures: true, reportLevel: 'tasks' }]
]

onlyFailures (boolean) -> used to print all the scenarios or only the failed ones.

reportLevel (string) -> Level of report verbosity: scenarios | steps | tasks | interactions.

Examples:

interactions

Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
        ✓ Wendy navigates to '/'                                                                    43ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:10
        ✓ Wendy ensures that <<current page>>.title() does end with 'Serenity/JS TodoApp'           5ms     file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:12
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
        ✓ Wendy waits until "What needs to be done?" input box does become clickable                128ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:9
        ✓ Wendy enters 'Walk a dog' into "What needs to be done?" input box                         15ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:10
        ✓ Wendy presses key Enter in "What needs to be done?" input box                             14ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:11
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
      ✓ Wendy hovers the mouse over item called 'Walk a dog'                                        174ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:9
      ✓ Wendy clicks on destroy button of item called 'Walk a dog'                                  58ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:10
    ✗ Wendy ensures that the number of list of items does equal 0                                   182ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:29

tasks

    Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
    ✗ Wendy ensures that the number of list of items does equal 0                                   182ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:29

steps

Given Wendy has a todo list containing "Walk a dog"                                                         file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/features/manage_a_todo_list.feature:11
    Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
When she removes an item called "Walk a dog"                                                                file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/features/manage_a_todo_list.feature:12
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
Then she ensures that the todo list is empty                                                                file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/features/manage_a_todo_list.feature:13
    ✗ Wendy ensures that the number of list of items does equal 0                                   182ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:29

scenarios

  ✗ TodoMVC actor removes the recorded items                                                        619ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:25

For the solutions that do not use cucumber the steps level should be invalid.

what do you think?

@jan-molak
Copy link
Member

jan-molak commented Apr 26, 2023

@damonpam Internally, Serenity/JS transforms Cucumber "steps" into "tasks", so that reporting is consistent across the test runners.

So in your proposed model we could have either all the activities, so tasks and interactions:

Wendy starts with a list containing 1 items                                                         205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
        ✓ Wendy navigates to '/'                                                                    43ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:10
        ✓ Wendy ensures that <<current page>>.title() does end with 'Serenity/JS TodoApp'           5ms     file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:12
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
        ✓ Wendy waits until "What needs to be done?" input box does become clickable                128ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:9
        ✓ Wendy enters 'Walk a dog' into "What needs to be done?" input box                         15ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:10
        ✓ Wendy presses key Enter in "What needs to be done?" input box                             14ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:11
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
      ✓ Wendy hovers the mouse over item called 'Walk a dog'                                        174ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:9
      ✓ Wendy clicks on destroy button of item called 'Walk a dog'                                  58ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:10

or tasks only:

Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
  Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
  Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
Wendy removes an item called "Walk a dog"                                                     232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28

and if there's a failure, we print the whole thing:

    Wendy starts with a list containing 1 items                                                     205ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:27
      Wendy starts with an empty list                                                               48ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:17
        ✓ Wendy navigates to '/'                                                                    43ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:10
        ✓ Wendy ensures that <<current page>>.title() does end with 'Serenity/JS TodoApp'           5ms     file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:12
      Wendy adds an item called "Walk a dog"                                                        157ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/Start.ts:18
        ✓ Wendy waits until "What needs to be done?" input box does become clickable                128ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:9
        ✓ Wendy enters 'Walk a dog' into "What needs to be done?" input box                         15ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:10
        ✓ Wendy presses key Enter in "What needs to be done?" input box                             14ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RecordItem.ts:11
    Wendy removes an item called "Walk a dog"                                                       232ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:28
      ✓ Wendy hovers the mouse over item called 'Walk a dog'                                        174ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:9
      ✓ Wendy clicks on destroy button of item called 'Walk a dog'                                  58ms    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/src/todo-list/RemoveItem.ts:10
    ✗ Wendy ensures that the number of list of items does equal 0                                   182ms   file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:29

    ✗ Execution failed with assertion error

      AssertionError: Expected the number of list of items to equal 0

      Expectation: equals(1)

      Expected number: 0
      Received number: 1

Something like this? 🤔

@jan-molak jan-molak pinned this issue Apr 26, 2023
@jan-molak
Copy link
Member

jan-molak commented Apr 26, 2023

Now, this makes me wonder. Perhaps all we need is for the developer to specify what "resolution" / "report level" they want:

  • scenario names only
  • scenarios and tasks
  • scenarios, tasks and interactions

When there's a failure, we print the whole thing anyway.

@damonpam
Copy link
Contributor

damonpam commented Apr 26, 2023

Yes, that's it!

I like this 3 report level

- scenario names only
- scenarios and tasks
- scenarios, tasks, and interactions

But I'd keep the failures configurable as well. And also the option to display in the details reporter only the failures or all the scenarios. If the summary reports all the scenarios, normally, I'd like to see only the failure with more detail. But maybe only until the tasks level to do not lose the flow context, could happen that tasks contain dozens of interactions... and that could be annoying... (at least to me 🙃)

@damonpam
Copy link
Contributor

damonpam commented Apr 26, 2023

Another concern I have regarding cucumber is the following. As you said, steps are transformed into tasks. So, having the following scenario:


Given Wendy starts with a list containing 1 items                                                                                      
When she removes an item called "Walk a dog"                                             
Then she ensures that the todo list is empty

we'll have the following report

Given Wendy starts with a list containing 1 items 
    Wendy starts with a list containing 1 items                                                     
      Wendy starts with an empty list                                                               
      Wendy adds an item called "Walk a dog"                                                        
When she removes an item called "Walk a dog"
    Wendy removes an item called "Walk a dog"                                                       
Then she ensures that the todo list is empty
    ✗ Wendy ensures that the number of list of items does equal 0    

As you can see, there are "duplicated" logs:

Wendy starts with a list containing 1 items 

// and 

she removes an item called "Walk a dog"

is there a way to avoid this behavior? 🤔

I have many cases where the steps only perform a single task with almost the same text and I find it unnecessary.

@ghost
Copy link

ghost commented Apr 26, 2023

Wow, this topic is really complex.

Particularly for me it would make sense that we could configure the reporter in the following ways:

// type LogLevel = "scenarios" | "tasks" | "interactions" | "none";

  crew: [
    ["@serenity-js/console-reporter", {
      theme: "auto",
      locationPattern: `${process.cwd()}/{path}:{line_number}`,
      reports: [
        ["details", {
          reportLevelOnFailure: "interactions", // will print interactions, task and scenarios 
          reportLevelOnSuccess: "tasks" // will print tasks and scenarios
        }],
        ["summary"]
      ]
    }]]

If I want only the details for the failures:

  crew: [
    ["@serenity-js/console-reporter", {
      theme: "auto",
      locationPattern: `${process.cwd()}/{path}:{line_number}`,
      reports: [
        ["details", {
          reportLevelOnFailure: "interactions", // will print interactions, task and scenarios 
          reportLevelOnSuccess: "none" // wont print anything
        }]
      ]
    }]]
};

@In1th
Copy link
Contributor

In1th commented Mar 2, 2024

// type LogLevel = "scenarios" | "tasks" | "interactions" | "none";

  crew: [
    ["@serenity-js/console-reporter", {
      theme: "auto",
      locationPattern: `${process.cwd()}/{path}:{line_number}`,
      reports: [
        ["details", {
          reportLevelOnFailure: "interactions", // will print interactions, task and scenarios 
          reportLevelOnSuccess: "tasks" // will print tasks and scenarios
        }],
        ["summary"]
      ]
    }]]

for me this is quite too specific, because in my project I have loads of custom interactions and tasks in between, like interaction 1, interaction 2, task, interaction 3. In that configuration it wouldn't make sense to print the task.

Summary                                         Time           Result            Location
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Managing a Todo List
  ✓ TodoMVC actor records new items             1s 382ms      Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:18
  ✗ TodoMVC actor removes the recorded items    619ms         AssertionError    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:25

Managing a Todo List
  ✓ TodoMVC actor marks an item as completed    384ms         Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/completing-items.spec.ts:9

I really like the format @jan-molak proposed, though I'd like to address retries in here. Currently retries count as separate tests and each test on CI gets 3 of them, so f. ex. two tests running 3 times (1 normal, 2 retries) will count as 6 tests in the current summary.

That's why It would be nice to have in a little bit better in the report, f. ex.

Summary                                         Time           Result            Location
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Managing a Todo List
  ✓ TodoMVC actor records new items             1s 382ms      Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:18
                                                              (on 2nd attempt)
  ✗ TodoMVC actor removes the recorded items    619ms         AssertionError    file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/manage_a_todo_list.spec.ts:25

Managing a Todo List
  ✓ TodoMVC actor marks an item as completed    384ms         Success           file:///Users/jan/serenity-js/examples/webdriverio-mocha-todomvc/spec/completing-items.spec.ts:9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants