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

Feature Request: GIVEN/WHEN/THEN support #5

Closed
iwubcode opened this issue Aug 21, 2018 · 4 comments
Closed

Feature Request: GIVEN/WHEN/THEN support #5

iwubcode opened this issue Aug 21, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@iwubcode
Copy link

I noticed in the walkthrough that nested sections are provided. I started using the GIVEN/WHEN/THEN capability in Catch2 and now find it hard to go back to sections!

If possible, it'd be awesome to support this alternate coding style in the test explorer.

@JohnnyHendriks
Copy link
Owner

GIVEN/WHEN/THEN are just aliases for sections, which are supported. For brevity I don't support them as part of the stacktrace output. My philosophy there is that you would click the link in which case you are transported to the code where you can get the GIVEN/WHEN/THEN context.

For the more detailed additional info you have to press the "output" link above the stacktrace. There you get the failures in context of the SECTIONs. You can use the <MessageFormat> setting to display this additional info as part of the error message if you want.

I do agree however that the SECTION related additional info can be formatted better. This would also improve the display when you use GIVEN/WHEN/THEN. So I put this is on the roadmap for the next version.

@JohnnyHendriks JohnnyHendriks self-assigned this Aug 25, 2018
@JohnnyHendriks JohnnyHendriks added the enhancement New feature or request label Aug 25, 2018
@iwubcode
Copy link
Author

Is there something needed to activate the multiple section 'levels'? I'm referring to this image:

https://github.com/JohnnyHendriks/TestAdapter_Catch2/blob/master/Docs/Images/Walkthrough-04.png

I do not seem to see it in my tests. I will play around with this a bit more. Thank you!

@JohnnyHendriks
Copy link
Owner

Ah, a picture tells a thousand word. This has nothing to do with sections. The image shows the Hierarchy view of the Test Explorer that was introduced to the Test Explorer in Visual Studio 20107 v15.6. The Hierarchy is based on information extracted from the test case name. See Capabilities - Notes on test case names for more information.

Sadly, there is no mechanism in the Test Explorer to use information about Catch2 sections to build this hierarchy. Section info is only used in the additional info part of a message for a test case with failures and/or warnings.

I kind of ran into a similar issue myself. As a result I have started to split my tests more into different test cases. Though I still make heavy use of sections as well, they typically just go one level less deep. An added advantage is that compilation times improve. I have noticed that the deeper nested section go the longer the compilation time is. I've had more than an order of magnitude improvement in compilation time when I completely flattened a test case into multiple test cases that didn't use sections at all. Though in the end I used only a partially flattened version of the test case, so compilation times were still acceptable while still maintaining the advantage of the use of sections.

@JohnnyHendriks
Copy link
Owner

Formatting of SECTION related additional info was improved in the v1.4.0 release.

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

No branches or pull requests

2 participants