TestCentric / testcentric-gui

TestCentric GUI Runner for NUnit
Other
68 stars 31 forks source link

Show details about test duration #1137

Open rowo360 opened 2 weeks ago

rowo360 commented 2 weeks ago

Describe the bug It's currently possible to group all tests 'By Duration', so that the user get some insights about slow running tests. That's already fine!

It would be even more helpful for the user if can view the exact test duration somehow. So that he can identify some bottleneeks easily and and knows where to start an improvement.

The test duration is already provided by NUnit, but it's not visualized so far.

Expected behavior The test duration is shown for each test case and test fixture in the test tree.

Environment (please complete the following information):

rowo360 commented 2 weeks ago

I suggest adding the test duration to the end of the texts of the treenodes. Here's a screenshot:

The test duration is available for TestFixture and TestCase nodes. When switching between the tree Display strategies or groupings, the entire tree will be rebuild, so that the tree node names will be set again.

Overall, I had the impression that this solution will work and is beneficial. However when I tried out this solution for a while, I asked myself why it's limited to the 'Duration' grouping at all. Isn't it beneficial for the user to get insights to the test duration in whatever strategy/grouping?

So, I came up with an idea to add a new context menu item:

As a result the test duration can be viewed in (for example) the NUnit tree too!

In this view the test duration is also available for the 'Namespace' nodes - but that's also fine! If you like the idea about showing the test duraction in all kind of strategies/grouping + the context menu approach, I will continue to work out this solution.

CharliePoole commented 2 weeks ago

I like the idea. Two thoughts...

  1. Is this a context menu item or a setting? Context menu items were intended to be transient, i.e. till you close the app. Settings were intended to be sticky. I think we have blurred that distinction somewhat by use of visual state, but let's think about it anyway.

  2. Do we need a feature to sort the nunit tree by duration? I.e. a new top-level sort menu item?

Some of this will take a while to work out. So go ahead with it but don't do a PR till after the beta6 release, which is unfortunately taking me longer than I thought it would.

Celebrating my 82nd birthday today, so I'll be back on Sunday. :-)

rowo360 commented 2 weeks ago

Congratulations on your birthday! Enjoy the day and celebrate!

rowo360 commented 2 weeks ago

I came up with the context menu idea just because it seems to be simple for the user to enable/disable it. (In contrast to some setting in the settings dialog - which must be found first of all and must be opened to enable/disable it.)

But we can actually decide whether and where this setting should be saved. I think I wasn't that strict in my mind so far that the context menu settings are always transient - therefore I prefer to save it in the settings. So when you restart TestCentric you will continue to work with your last configuration. The user enabled this settings at some point in time in the past, so he can disable it again, if he doesn't want this feature anymore. Another option is to save it in the VisualState file. That means that this setting can be individually controlled for each test assembly. I think that's not required for the start. The test durations will be displayed anyway only after a test run, not right away after loading a test assembly. Moreover the user can activate 'Show test duration' at some point after a test run and the durations will be shown immediately (starting a new test run is not required).

So saving this in the settings seems to be fine for me.

The option to sort by test duration is certainly helpful. This means that users do not have to search hard for the slowest test theirself, but just start sorting. And if we start to support sorting, we can then do the alphabetical sorting at the same time. So a new feature is a good idea.

rowo360 commented 1 week ago

@CharliePoole : I continued to work on this issue and I have now reached a point where I'm confident about the solution. So either I can create a PR or start to discuss it... However you mentioned that you prefer to place this behind the beta6 release - that's fine! Just give me a hint when it fits best to continue with the next step.

CharliePoole commented 1 week ago

@rowo360 The release is out. Check for an email I sent you.

I'd say go ahead with the PR. I'll take a look at it in the morning.