Unit Testing Vue Apps: Tips, Tricks, and Best Practices

  Рет қаралды 13,444

Vue Mastery

Vue Mastery

Күн бұрын

Пікірлер: 10
@devincit
@devincit 2 жыл бұрын
Nice presentation with actually great examples of how to write descriptions of the tests. Most of the tests are written in implementation agnostic way! Not everyday you see those. 8:20 - 9:28 Those are not unit tests. it's a mish mash of behaviour and integration testing, maybe there are some unit tests. Later examples are the same: lot's of bahaviour/integration testing. If you are testing the reaction for user interaction (clicking the button) it's not a unit test. Unit test would be just testing the callback method used by the event listener. Just my opinion. 18:46 there are much better ways to do that. You can generate TypeScript interfaces from swagger files or openapi files. Then you have not only documentation of contracts, but also you can use those to create mocks even when the endpoint isn't no yet complmeted or deployed. Also using generated interfaces create guards on contracts itself. If the backend modifies request or response contract builds will fail. No need for further automated testing. 19:59 It's a lot of mocking for just unit testing. It just confirms my previous concern that these tests are not unit tests 28:40 I believe that mocks-server and json-server have the ability to make real api calls and then cache them. Probably there was another tool, but I can't remember. Last time we used mocks generated by backend tools - some library for dotnet that generated responses based on types. Thera are also tools for generating json’s, so if you have swagger or openapi files, you can generate schemas and than payloads/responses from them.
@wobsoriano
@wobsoriano 2 жыл бұрын
One thing I notice when unit testing components is that it turns immediately into an integration test.
@devincit
@devincit 2 жыл бұрын
​@@wobsoriano there is no other way. but it's fine. just need to understand and accept that and that unit testing for frontend applications is almost useless. only few cases where it make sense
@josephjoestar4318
@josephjoestar4318 Жыл бұрын
@@devincit Thanks, this helps ease my mind a little. It really does feel absurd to try and test everything in isolation. For the moment I'm integration testing pages - and - unit testing components with prop drilling.
@NaLoPe24
@NaLoPe24 9 ай бұрын
Isn't your concern exactly why the Vue docs call this component testing and not unit testing?
@RalphHarrer
@RalphHarrer 2 жыл бұрын
Thanks for that talk! It gives a really great overview of how to get started and how to test properly! Well done. Helped me a lot.
@danielgolden6991
@danielgolden6991 Жыл бұрын
This talk is so helpful (thank you!) Aren't the colors of buttons also implementation details?
@josephjoestar4318
@josephjoestar4318 Жыл бұрын
This filled in all the holes that I had been missing.
@_the_one_1
@_the_one_1 2 жыл бұрын
WOW! Amazing talk! Nevet thought of writing tests like this. Thank you
@geekmaros
@geekmaros 2 жыл бұрын
Great insight into Testing
The Future of Nuxt 3
29:52
Vue Mastery
Рет қаралды 7 М.
7 ways to make your Vue unit tests better by Natalia Tepluhina
25:44
VueConf Toronto
Рет қаралды 10 М.
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Mobile Development in Vue
17:52
Vue Mastery
Рет қаралды 12 М.
Test driven development with Vue.js by Sarah Dayan
31:07
VueConf Toronto
Рет қаралды 35 М.
Vue and Typescript | When to use it
9:15
Vue Mastery
Рет қаралды 30 М.
Learn Vitest and Testing Library In 40 Minutes
40:12
Program With Erik
Рет қаралды 59 М.
Why Vitest Is Better Than Jest
13:13
Web Dev Simplified
Рет қаралды 141 М.
Vue Mastermind Evan You answers Vue devs' questions 🌟
15:50
Vue Mastery
Рет қаралды 6 М.
Using Vue Test Utils in Vitest
4:36
LearnVue
Рет қаралды 25 М.
Building Accessible Vue Components
41:03
Vue Mastery
Рет қаралды 6 М.
Common Mistakes in Vue.js and How to Avoid Them | VueConf US 2024
25:16
Learn Vite with Evan You
13:35
Vue Mastery
Рет қаралды 270 М.