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

Add testing documentation #1416

Closed
wants to merge 2 commits into from

Conversation

csc530
Copy link

@csc530 csc530 commented Dec 29, 2023

contributes to #1410

  • I have read the Contribution Guidelines
  • I have commented on the issue above and discussed the intended changes
  • A maintainer has signed off on the changes and the issue was assigned to me
  • All newly added code is adequately covered by tests
  • All existing tests are still running without errors
  • The documentation was modified to reflect the changes OR no documentation changes are required.

Changes

I added pages three new pages to the docs related to the testing namespace of Spectre Console.
It gives examples and some usage and use cases for the testing classes (that are hopefully correct and reflect reality).
The documentation is written from what I could find, understand, and have done using Spectre Console.


Please upvote 👍 this pull request if you are interested in it.

@csc530
Copy link
Author

csc530 commented Dec 29, 2023

@microsoft-github-policy-service agree

@FrankRay78 FrankRay78 self-assigned this Jul 31, 2024
@FrankRay78 FrankRay78 self-requested a review July 31, 2024 11:10
@FrankRay78 FrankRay78 added this to the 0.49 milestone Jul 31, 2024
@FrankRay78
Copy link
Contributor

Hello @csc530, thank you for this contribution, enhancing documentation is always welcome.

I'd like to make a few grammar/stylistic changes (to align with the rest of the documentation).

Are you happy for me to force-push to this branch?

@csc530
Copy link
Author

csc530 commented Jul 31, 2024

Yeah, that would be fine

Also, I wasn't sure how to add the new testing documentation section to the sidebar, I tried adding "../../src/Spectre.Console.Testing/**/{!bin,!obj,!packages,!*.Tests,}/**/*.cs", and variants to the Constants.SourceFiles in Program.cs, but I couldn't get them to show.

@FrankRay78
Copy link
Contributor

Also, I wasn't sure how to add the new testing documentation section to the sidebar

I can't exactly remember but will take a look.

@FrankRay78
Copy link
Contributor

This is now top of my TODO stack to get over this line.

@patriksvensson patriksvensson modified the milestones: 0.49, 0.50 Sep 2, 2024
Copy link
Contributor

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Left some comments

return result;
}

public static void appConfig(IConfigurator config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to something like ConfigureCommandApp?

{
public override int Execute(CommandContext context)
{
AnsiConsole.WriteLine("Hello world");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Command should not use AnsiConsole directly, since this doesn't play well with testing. The command should inject a IAnsiConsole and use that.

{
// Given
var console = new TestConsole();
// When
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Add line break

var console = new TestConsole();
// When
console.WriteLine("Hello world");
// Then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Add line break

public class ProgramTests
{
[Fact]
public void Should_Return_Hello_World()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great example! 👍

@FrankRay78 FrankRay78 changed the title added testing documentation Add testing documentation Sep 4, 2024
@FrankRay78 FrankRay78 linked an issue Sep 5, 2024 that may be closed by this pull request
@FrankRay78
Copy link
Contributor

Dear @csc530, thank you for taking the time (and initiative) to submit this PR.

I've taken the time to review it, but also more importantly, to step back and review the bigger need for testing documentation. Whilst I'm happy with your PR, the multiple various discussions else where about testing shows to me a much more comprehensive need to write up testing guidance. I'm sorry but on this occasion I'm going to close your PR, and if you like, you can follow my attempt to write something more detailed here: #1631

I am always looking for new contributors, however, so if you'd like to try your hand at another issue that would be most welcome. I suggest you tag me in before commencing any work, so I can provide guidance as you go along and discuss any issues etc, ahead of final review. It will ensure your contribution ends up getting merged. Once again, thank you, and please don't take this as any indication of your workmanship.

@FrankRay78 FrankRay78 closed this Sep 5, 2024
@csc530
Copy link
Author

csc530 commented Sep 5, 2024

Ok, thanks for the feedback :)
I'll keep my eyes out for anything I can help with, too

@FrankRay78
Copy link
Contributor

Hello @csc530, sorry to bug you. Myself and the other maintainers have been discussing my closing of your PR. Basically, we've agreed that I should not have closed it, and should not have started authoring a replacement. We felt that behaviour might result in other contributors not stepping forward, and wasn't respectful of your time and effort. Instead, I should have spent more time with you and your PR, explaining what the bigger need was and helping you author that, if you were still interested. We could have just said nothing following our internal discussion, but I felt it only fair to write it here and admit my actions were not well considered (not usually the case for me). If I technically can, and if you agree, I'd like to add you as a co-author of my PR once finished, so you become part of the commit history of Spectre.Console, as a gesture of good wIll and to acknowledge your original PR.

@csc530
Copy link
Author

csc530 commented Sep 17, 2024

Oh!? Thank you, that would be really cool of you😊.

I have looked around a little on the repo in discussions and issues about testing and documentation and gathered how my PR could be lacking.

Honestly, this was more of a small starter PR to contribute to OSS and has been a good learning opportunity still. I've been busy too, so I'm not taking it too hard.

I hope I can make time to follow your progress and find other ways to contribute to the project. Thx again

@FrankRay78
Copy link
Contributor

Ok @csc530 , you are now the co-author of the following PR:

https://github.com/spectreconsole/spectre.console/pull/1631/commits

image

We squash commits when merging, so the last message should disappear and it will be you and I as the authors of the commit to main.

FYI. I maintain the command line subsystem of Spectre.Console, so anything with the area-CLI label I can help with.

https://github.com/spectreconsole/spectre.console/issues?q=is%3Aopen+is%3Aissue+label%3Aarea-CLI

Just tag me directly in the issue before starting at any future point.

Until then, be well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: PR 📬
Development

Successfully merging this pull request may close these issues.

Testing documentation
3 participants