Nouvola, an upcoming cloud based performance testing platform, did not have a ruby gem. With a comprehensive api, this was the perfect candidate for my first open source project. The api allows me to run a test plan and collect the data from the test run. One of their newest features which is not yet documented is the ability to add a webhook to a test plan. Without this new feature, my script would have to poll every X minutes for test results. Even though Nouvola offers a jenkins plugin to do what this gem does, sometimes it is nice to have if you don't want to set up a Jenkins server to do performance testing. Additionally, you can get the test results and run your own analysis. Assuming you have a test plan, this is all that you would need to use the gem (and are familiar with ruby). Information about the gem can be found at the github repository. First and foremost, get your api key. After logging into DiveCloud, go to you account and select API & Keys. The next thing you would need is the plan id. If you don't have a test plan, you can create one by following this tutorial. INSTALLING THE GEM To start using the gem, install it by using the command 'gem install nouvola'. gem install nouvola As of this writing, the current version is 1.0.1. SETTING THE WEBHOOK For this example, I'll use requestb.in to provide me a url for testing the webhook. Opening the console, I'll enter the following: irb(main):001:0> require 'nouvola' If it is successful, simply type irb(main):007:0> response.body and you'll receive the following: => "{\"result\":\"success\"}" RUN A TEST PLAN Assuming you haven't exited the console, type the following lines code replacing with your api key and plan id: irb(main):008:0> test = Nouvola::Divecloud.new(key) If successful, response.body should return the following: irb(main):010:0> response.body GET RESULTS From the response, you'll be given a test_id. This value is what we'll need to get the results from our test plan's latest run. Assuming the time has elapsed for your test, you can refresh the requestb.in page that you used. The following should appear on the page: If successful, you can enter the following to get the results. irb(main):011:0> test_id = 5056 Type response.body and the results for your test is provided to you in JSON format. Now, you have data that you can parse through and investigate what is going on. Of course, you can always use the reporting features that are already provided by Nouvola.
You can view the gem on ruby gems, https://rubygems.org/gems/nouvola, or the source code on github, https://github.com/mlaguren/nouvola-gem. Comments are closed.
|