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

Unit test framework for Blazor #5458

Closed
2 tasks
danroth27 opened this issue Jan 25, 2018 · 12 comments
Closed
2 tasks

Unit test framework for Blazor #5458

danroth27 opened this issue Jan 25, 2018 · 12 comments

Comments

@danroth27
Copy link
Member

@danroth27 danroth27 commented Jan 25, 2018

  • Unit test helper for instantiating components and trying out events, etc.
  • End-to-end
@RehanSaeed
Copy link
Contributor

@RehanSaeed RehanSaeed commented May 23, 2018

Please also consider snapshot testing, similar to Jest. I've been using it with Vue.js and I've found it to be a great way to test UI without being too fragile and needing constant fixing.

Loading

@veikkoeeva
Copy link

@veikkoeeva veikkoeeva commented Jul 24, 2019

Probably under consideration, but it appears the end-to-end tests could work with Puppeteer.Sharp (ping @kblok, the Selenium libraries are also an option) using something like Razor Live Reload with the usual ways of starting a web server in tests. Then have examples how to collect performance numbers, test some CSS driven things, web components and Service Workers. Could be interesting to load tests dynamically so one could test mobile browsers too (especially performance).

Cypress and TestCafe could be some examples, albeit I'm not sure how much overlap there are with assertion libraries, like XUnit.

<Edit: One consideration is also isomorphic situations, one being something that can be run or mimicks environments like Cloudflare Workers, e.g. https://github.com/anywhichway/dexterous or https://github.com/envato/cloudflare-worker-test-harness .

Loading

@rjperes
Copy link
Contributor

@rjperes rjperes commented Dec 19, 2019

Question: is this for publishing Microsoft.AspNetCore.Components.Testing?

Loading

@mkArtakMSFT mkArtakMSFT removed this from the Backlog milestone Jan 10, 2020
@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview1 milestone Jan 10, 2020
@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview1 milestone Jan 10, 2020
@mkArtakMSFT mkArtakMSFT added this to the next sprint planning milestone Jan 10, 2020
@mkArtakMSFT mkArtakMSFT removed this from the Next sprint planning milestone Jan 23, 2020
@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview2 milestone Jan 23, 2020
@SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented Feb 6, 2020

@RehanSaeed just an FYI, I maintain a snapshot style testing lib https://github.com/SimonCropp/Verify. and i am actively tracking blazor testing to see if i can add any specific value to that scenario. Happy to accept any suggestions you have

Loading

@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview2 milestone Mar 11, 2020
@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview4 milestone Mar 11, 2020
@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview4 milestone Apr 27, 2020
@mkArtakMSFT mkArtakMSFT added this to the 5.0.0-preview5 milestone Apr 27, 2020
@mkArtakMSFT mkArtakMSFT removed this from the 5.0.0-preview5 milestone May 5, 2020
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone May 5, 2020
@mkArtakMSFT mkArtakMSFT changed the title Testing Unit test framework for Blazor May 5, 2020
@danroth27
Copy link
Member Author

@danroth27 danroth27 commented May 15, 2020

Hi folks. At this point, we think providing testing framework support for Blazor is something that can best be handled by the Blazor open-source community. The bUnit project, for example, already provides support for unit testing components and implements many of the implementation ideas that we were exploring. Instead of building and supporting our own test framework, we prefer to encourage community innovation in this space, which allows us to focus our efforts on core framework improvements. Given this decision, I'm going to go ahead and close this issue.

Loading

@danroth27 danroth27 closed this May 15, 2020
@SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented May 15, 2020

FWIW i think this is a mistake. if you dont explicitly design for things to be testable (from an application perspective) then result will not be testable. and having the only test frameworks as downstreams means they will be too disconnected from you design process to give timely feedback.

Loading

@danroth27
Copy link
Member Author

@danroth27 danroth27 commented May 15, 2020

If you don't explicitly design for things to be testable (from an application perspective) then result will not be testable. and having the only test frameworks as downstreams means they will be too disconnected from your design process to give timely feedback.

We certainly agree that Blazor needs to be designed to be testable, and we do consider testability in our design process. We of course welcome feedback in this area! As for whether test framework authors would be able to give us feedback in a timely fashion on design decisions, I think that should be possible by us continuing to do design and development in the open and also shipping frequent preview releases.

Loading

@SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented May 16, 2020

how about inviting the bunit team to merge projects and join the core blazor team

Loading

@SimonCropp
Copy link
Contributor

@SimonCropp SimonCropp commented May 16, 2020

I think the disconnect is already apparent. eg the absence of testing from docs https://docs.microsoft.com/en-us/aspnet/core/blazor/get-started?view=aspnetcore-3.1&tabs=visual-studio and many (other wise very complete) samples eg
https://github.com/dotnet-presentations/blazor-workshop

Loading

@githubfanster
Copy link

@githubfanster githubfanster commented May 16, 2020

i was so looking forward to microsoft's own blazor testing framework (especially after i saw it included in the recently published roadmap).

is the bUnit project going to at least be a .Net Foundation supported project?
right now, it seems like mostly a one person project and i'm afraid of that kind of uncertainty

Loading

@danroth27
Copy link
Member Author

@danroth27 danroth27 commented May 16, 2020

@SimonCropp We do have documentation gap on how to do component unit testing with Blazor. We've been tracking adding it for a while (dotnet/AspNetCore.Docs#10747), but we wanted to decide first whether we would be building a test framework or not (this issue). Now that we've decide to go with the existing community solutions, we've already started talking to the bUnit project owner about adding this content both to the docs and to the Blazor workshop. I don't think this reflects a disconnect with these community projects - it just reflects limited time and resources.

@githubfanster I brought this up with the bUnit owner earlier today as well. The thinking is that we will wait until bUnit hits 1.0, and then start the submission process.

Loading

@egil
Copy link
Contributor

@egil egil commented May 16, 2020

@SimonCropp if time allows, I will contribute docs about testing and a lab to the Blazor Workshop, but as @githubfanster noticed, I'm just one person, so right now I am prioritizing getting bUnits own docs up to date for the beta-7 release.

@githubfanster I do want to move the project into the .net foundation as soon as possible. And I also welcome any form of help I can get with the project.

Loading

@msftbot msftbot bot locked as resolved and limited conversation to collaborators Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants