Comments (18)
Great, thanks for this summary!!!
I found some great references search Gitter for mocha
:
https://gitter.im/publiclab/publiclab?at=59359203cf9c13503c570db7
ananyo2012 Did you find which testing framework has a better support for API testing?
ryzokuken Both Jasmine and Mocha have pretty solid support for API testing, I think.
ryzokuken I'll need to confirm that though.
ryzokuken You can even mock APIs in Mocha, I've heard.
ryzokuken http://robdodson.me/mocking-requests-with-mocha-chai-and-sinon/
ananyo2012 Yes Mocha has good support for mocks and Stubs
matrixbot @matrixbot Jun 05 2017 13:16
ryzokuken Actually, native Mocha doesn't come with any mocking/stubbing library like Jasmine
ryzokuken this allows us to use Siphon, which is more powerful than what comes preloaded with Jasmine.
Also from one of these results, input from @ananyo2012 (Hi Ananyo!!!!):
I was reading this: http://stateofjs.com/2016/testing/ today
To decide on what testing framework we should use
Seems like Mocha and Jasmine are the 2 most used JavaScript testing frameworks
But I dont really want to go with numbers
And my thoughts on it were:
Hi! On testing setups, we generally consider a few things: a) is it easy for newcomers to set up, b) is it well documented and maintained (maybe jasmine less so these days, i'm hearing from you all?), c) can we have consistency across our projects so people's skills transfer when moving between, and maybe others. But these are not blocking concerns; they just need to be balanced with the benefits. So if we're just trying mocha because it seems interesting, maybe not worth it, but if for one of these reasons it's better than Jasmine, and the pros outweigh the cons, go for it! Also, to some degree, if you've put hours into mocha and switching would be a lot of work, that's a good thing to consider too. Thanks!!!
from simple-data-grapher.
As far as mocking support is concerned, along with ananyo's concerns, I'd say the we should give Jest a spin. It wasn't there back in 2012, or wasn't atleast popular so to say, but it's got everything, from headless support (below) to semantic expect
and it
APIs for the newer contributors.
I can go ahead in this direction, explaining the whats and hows and even integrate it into this lib, given @jywarren and @publiclab/soc decide to pursue this direction.
from simple-data-grapher.
I am okay with it I think since I am just exploring the three. have just begun with Mocha, although to start my testing, I require to create a UI test first. So that's why I got a little curious as to which framework we should use. I have seen the example given by @rexagod and I think it's pretty good. @jywarren what do you think? Should we give jest a shot?
from simple-data-grapher.
@rexagod I have a small doubt. I need to test my CsvParser functions first (before moving to View's functions), but to do so, I need a div
element ie a mock of a div element, because when the function reaches this line:
simple-data-grapher/src/CsvParser.js
Line 43 in c1dda36
simple-data-grapher/src/View.js
Lines 311 to 315 in c1dda36
from simple-data-grapher.
var div = document.createElement('DIV');
div.setAttribute('id','xyz');
...
...
div.parentNode.removeChild(div);
Dynamically create, run tests on, and remove the div
.
from simple-data-grapher.
Create this where? Btw this is what is there in the index.html
file:
simple-data-grapher/examples/index.html
Lines 15 to 21 in c1dda36
from simple-data-grapher.
Add and delete the div during the period of the test run. Create the div, when test is done with it, destroy it.
from simple-data-grapher.
Could you please elaborate a little more, I am so sorry to ask so many questions, I am actually unable to understand the flow here?
from simple-data-grapher.
What exactly are you unable to understand?
from simple-data-grapher.
from simple-data-grapher.
SimpleDataGrapher.elementIdSimpleDataGraphInstanceMap[this.elementId].view.continueViewManipulation();
Just before this line, make a div using js (syntax above). Actually there's no need to destroy it just don't append it to the DOM. Refer to that div's id in your tests. That's it!
from simple-data-grapher.
Hey all. Nice to have mentioned. That was quite some time back I had that discussion with @ryzokuken on testing framework. Here is what I feel on choosing a testing framework
- Should have good mocking libraries. Having written tests in multiple frameworks and languages I feel this one is a major thing to consider. We don't want to spend a lot of time to write a mock or a stub which also makes it difficult to maintain.
- Unit tests should be fast. With time the number of tests increases and so the time taken to execute them. You don't want to wait a long time to have tests to pass.
- Should have good documentation as @jywarren mentioned. With a bunch of testing frameworks out there it can be difficult to consider which one to choose to from with just the above 2 points. When in dilemma always choose the one which has good support and documentation.
from simple-data-grapher.
I use Jest (because I'm lazy) these days mostly, but both Chai and Mocha are nice testing libraries. Please feel free to hit me up if you need help/more context regarding any.
from simple-data-grapher.
Hi everyone, I changed the tests in plots2 from Jasmine to Mocha because jasmine-rails was unable to test modern ES features. So, there was a need for another testing suite and Mocha seems perfect at that time.
from simple-data-grapher.
Hi, this is not the same thing but a related convo on build tools was here - just found it: publiclab/PublicLab.Editor#227
from simple-data-grapher.
I was curious to know @publiclab/soc @publiclab/reviewers opinions on using npm scripts as the ultimate task runner, just to keep things simple and way more flexible, while considerably reducing the bug count (no third-party mirrors of deps). I guess we can consider integrating the newer modules with gulp
or webpack
or even grunt
if people see advantages in the same, otherwise, maybe we should consider the former as well?
from simple-data-grapher.
from simple-data-grapher.
Any suggestions for UI testing with mocha @jywarren @namangupta01 @rexagod ?
from simple-data-grapher.
Related Issues (20)
- Gif should be added for showing the working of this project HOT 1
- Remove unused variable HOT 4
- Typo error in contributing.md HOT 2
- Add a proper header/navbar in the main page HOT 3
- Add a footer to the page HOT 3
- Refactor html to follow standard structure HOT 3
- `npm start` default port HOT 1
- Add config.yml for welcoming new users HOT 4
- Update tests to pass Travis CI build HOT 6
- Add test case for the footer HOT 5
- Add Code of Conduct badge and build status badge in the readme HOT 4
- Not drawing correct result HOT 3
- Putting the graph in my own website and matching up my own layout HOT 1
- Publish Graphs as a Research Note HOT 20
- Removing unused code HOT 15
- Redesign Add Graph Button HOT 15
- Add space in the button for clarity HOT 12
- Remove unnecessary console.log statements HOT 9
- Setup Travis CI in the project HOT 4
- Save file option for Create Spreadsheet Button HOT 1
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 simple-data-grapher.