bloc referral

If you are interested in learning to code with a mentor, try bloc and get $100 off.
Showing posts with label testing. Show all posts
Showing posts with label testing. Show all posts

Thursday, November 20, 2014

Setting up Jasmine TestRunner

Shortly after I wrote my previous post I found this awesome video on getting the Jasmines Test Runner set up. Javascript testing is still a mystery to me when it comes to set up and preferred DSL'a, but it seems as if Jasmine is quite popular and where I will be spending most of my time.

I am also interested in Chai, just because it sounds so good with Mocha

I can't recommend Koans enough

I have basically gone through the majority of Eloquent Javascript, working through problems here and there,  and just about done with it. The book has definitely taken more time to get through than expected, mainly because it is new territory for me. I have found that Javascript is language I have to get hands on writing with, actually Ruby was the same way. I can't just read Eloquent Javascript and pick up the concepts.

I have found great success working through Javascript Koans. The basic form of Koans are simple programming test which you make pass by literally inputting the answer given. I did spend time filling in the answers without looking them up but when I got stuck all I need to do is run the test and read the assertion for help. My explanation of Koans does not give it justice, which is why I highly recommend checking it out for yourself.

Prior to moving to Orlando and taking my job at IZEA, I work through the entirety of Ruby Koans, this helped me learn the syntax of Test::Unit. Previously I only had experience with Rspec and the majority of the testing at my new job was Rspec.

Another thing the Koans taught me was how to write more test. The structure of Javascript and Ruby Koans does not require you to write test, but from reading the already made test it help me understand how to write proper and more extensive test.

Like I said in a previous post, it's hard to be inspired when you never look at the way others do things. If you write Javascript or Ruby and are not testing currently or want to expand your knowledge into testing, download the repos for Ruby and Javascript Koans today.

*Please note there are other types of Koans out there but I feel these are the best introductions into them.


Friday, July 18, 2014

save_and_open_page method

When I interviewed for this job, I have to admit I said I had Capybara experience but I honestly really didn't. The most experience I had was from install it on my app and not knowing how to use it. I also had failing integration test on my Hartl app but commented them out. Thanks to this job I was able to understand how to use Capybara and even write actual integration test. 

One thing I learned that has been tremendously helpful is using the save_and_open_page method, you literally place that code above the last line of your test and Capybara will save and open that instance of the page, no internet required. Now you will be able to check out the page and find out why a test is failing, by seeing what info is not displaying.

Check out the following blogpost for more info: Ever heard of the sava_and_open_page method?



I find it very similar to how I have learned how to debug Javascript, using the alert("foo") or console.log("foo"), but thats another blog post. If you are unfamiliar with integration testing checkout thoughbot's blogpost on it.

I realize some of these post will not be useful to some readers of my blog. I recommend keeping these tips in the back your mind, because they will eventually become very useful. I am personally using them as my notes to go back to, just as the Ruby Rogues explained. I hope to google the save_and_open_page method one day or any other tipI wrote about and find it in the top ranking on google. So save this, bookmark it, and thanks for reading.


*Please note this method will not work without the gem "launchy"