Comments (15)
So I've played around with testing in Ava and all the examples are made with e2e testing in mind, which involves setting up a server, and making requests to it. As it is all asynchrous, Ava seems to be doing a good job. I noticed aswell, that the project is set up as an spa, so a server should not be needed.
I also tried Jest, to see how it would work and integrating it into Nuxt is not that bad, it is simply used like in any normal Vue app. It only requires 3 packages, Jest itself, @vue/test-utils and vue-jest, but the last one has to be version 4.0.0-0 at least. It is supported by Nuxt itself, though there are no examples for that, in create-nuxt-app cli, there is an option to enable Jest or Ava as a testing framework.
Also, for unit tests, it would be best to use Vue Test Utils and according to this https://github.com/eddyerburgh/vue-unit-test-perf-comparison, there are performance considirations with Ava. It was made 2 years ago, so it might be fixed already, but when I was checking them, Jest seemed to be faster. There might be a problem with Jest though, that supposedly it doesn't trigger asyncData(). I haven't checked it myself, but apparently, it can be fixed by calling it manually.
from hoppscotch.
@NBTX I did, I think both work well but Ava has a bit more dependencies and a setup file to actually be able to parse vue files. Jest just seems a bit simpler for me, I wrote a few tests already to check how it works with nuxt and so far, it is really simple. From what I have found, Ava seems to excel at async tests while Jest is great with running tests in parallel, which is great for ui testing.
from hoppscotch.
Right. I'll do a PR with cypress then.
from hoppscotch.
I think now its the time for next version release 🚀
Remaining v1.0 milestone tasks:
- #93 Import request from cURL
- #62 Fast URL entry
- #33 Code highlight on response body : PR #76
- #29 Ability to store/share/create collections : #72 Enable shareable requests with parameters in url queries
- #2 #128 CORS
from hoppscotch.
@liyasthomas the setup is almost done. I will send a PR tomorrow.
from hoppscotch.
Agreed, we definitely need some proper unit tests. Nuxt seems to prefer Ava for testing.
https://nuxtjs.org/examples/testing
from hoppscotch.
Makes sense, Ava seems to be fast with async tests but they use it only for e2e testing, I don't know if it can be used for unit tests. We could also use Jest which is officialy supported by vue but seems to be a bit harder to setup with Nuxt. But if we don't need unit tests, then Ava seems to me like a good choice.
from hoppscotch.
We we need these badly. I think Jest can also be integrated with Nuxt with a catch (https://stackoverflow.com/questions/52493255/integration-testing-with-nuxt-and-jest) but AVA seems to have out of the box support to Nuxt for E2E and unit testing.
from hoppscotch.
@Amoroth Have you checked the code/scripts that create-nuxt-app
runs for setting up either test libraries? The Nuxt team is pretty 'on it' and it's possible they've patched these kinds of issues in their setup process.
from hoppscotch.
I made a setup and created some e2e tests with cypress Im a personal dev purpose branch. If you're considering cypress I can do a PR with this setting.
from hoppscotch.
@yubathom I personally haven't used Cypress before. But if it does the job we can consider using it. If anybody else is working on Ava or Jest they can continue that.
from hoppscotch.
I'm not particularly familiar with any testing libraries in particular, so I don't really mind which we use. I just took a look at a unit test you linked and it looks fine to me.
TL;DR: I'm happy with Cypress.
from hoppscotch.
I don't know anything about Cypress but it looks like an e2e testing framework specifically. I don't think that is bad at all but doing unit tests in it may be harder as Vue Test Utils doesn't support it, it may work though, I don't know. Cypress, I think, works by spinning up whole local server and runs tests against it, while Jest works in isolated enviroments that just simulate real browsers. I didn't do any e2e tests yet, but I have worked on some unit tests already in Jest, you can look at how it looks like, setup and structure, here. Now, I would like to point out, that I am no professional and the test cases may be awful, but I guess it's a start.
from hoppscotch.
@Amoroth @yubathom is there any updates on this issue? I hope stable release v1.0 will be at the end of this week and it would be great to run some tests!!
from hoppscotch.
#181 resolves this hence closing.
from hoppscotch.
Related Issues (20)
- [feature]: Automatically focus on renaming HOT 1
- [bug]: forbidden by avira
- [bug]: Tried to initialize service with no container (ID: LICENSING_SERVICE) HOT 2
- [feature]: Run Collection To Test All API's HOT 1
- [bug]: Searching in a long request body,slide to the end,the body below is blank.
- [bug]: Code generation not working HOT 2
- annoying "Set as variable" popup on any text highlight HOT 3
- Option/setting to change the sidebar position. HOT 3
- [bug]: how set default content type,
- [bug]: Interceptor not saving selected option HOT 3
- [feature]: configurable banner for announcements / news for Selfhosted
- [feature]: Record the day of the last login
- [feature]: API for user management
- [feature]: audience support for OAuth2.0 client credentials HOT 1
- [bug]: incorrect multipart/form-data body HOT 1
- [bug]: Lost all saved data after recent update HOT 6
- [feature]: Use jq instead of JSONPath for filtering JSON HOT 1
- [feature]: Distribute to vscode marketplace
- [feature]: Environment variables in Collection properties
- Don't exist a file .env in the root directory - Failed build
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hoppscotch.