Dovetail blog posts by Murilo André da Silva

Selenium not shutting down when running automated protractor tests with TeamCity. Fixed.

In the last couple of weeks Kit and I have been working on how to integrate automated tests into the QuickDBD (great tool, you should try it if you didn’t) application. The challenge was to make our tests work with gulp and Teamcity, in order to automatically run them every time we deploy a new release. QuickDBD is an angular application so we decided to use protractor as our testing framework.

This nice tutorial showed us all the required steps but we had an issue where our tests started on Teamcity but never stopped, leaving the process running indefinitely on the server. I didn’t find the solution for this problem anywhere on the internet so I’m using this post to share our solution with the world.

As mentioned in the tutorial, in order to integrate protractor with gulp you need to install the gulp-angular-protractor. This package automates everything you need to do in order to run protractor, which includes starting and stopping the selenium server and that was actually where the problem laid.

When you configure your gulp task with gulp-angular-protractor it will look similar to this:

The autoStartStopServer: true is used to tell gulp-angular-protractor that it should handle the stopping and starting of the selenium server. But the stopping part wasn’t working.

In previous versions of selenium the following url was used to shutdown the selenium server (considering you are running selenium on the default port 4444):

http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer

Gulp-angular-protractor was trying to shut down the selenium server but since selenium server 3.0, this url for some reason was removed.

The solution we found was to tell gulp-protractor-angular to run a previous version of selenium server, which contained the shutdown url, by configuring the gulp task in the following way:

I hope this helps whoever is going through the same issue.


Angular, timezones and Datetimepickers

Recently we developed an angular application for one of our Multinational clients with the purpose of helping them to manage accommodation, transfers and flight times. This app had to deal not only with dates but also time and we looked into many different date and time pickers created specifically for angular in order to deal with that. We ended up selecting angular-bootstrap-datetimepicker as our choice.

At first hand everything went fine but during development the daylight saving period started here in Ireland and we noticed the dates being stored in the server started to differ of what we were picking in the app by one hour.

Javascript is somewhat confusing in how it parses dates, times and timezones, even some browsers handle some things in different ways and what was happening was when the datepicker was parsing the date into a javascript object it was also adding local time information e.g. 19/05/2017 11:18:00 +1 hour instead of 19/05/2017 10:18:00, which was actually the “numbers” that were picked in the datepicker. When this information was being sent to the backend, the server was parsing this date object without timezone information so the date being stored in the server was one hour wrong.

We didn’t want the application to be timezone aware, we wanted the users to pick a date on the datepicker and store that date made of the “numbers” that were picked. No smart conversions or anything like that.

The datepicker already provided support to moment.js (which basically the whole world recommends it if you are dealing with dates in javascript) so all what we had to do was to ensure when we are setting dates using the picker the selected date was in UTC timezone.

In order to achieve this behavior we had to add moment-timezone which gave us support to deal with timezones and then changing the code of angular-bootstrap-datetimepicker in the following way:

On the datetimepicker.js file, on the function setTime, one line after case ‘moment’ we added moment.tz.setDefault(“Etc/UTC”) in order to enforce the timezone to UTC every time we are setting a date.

By telling the datepicker to use moment we started to have issues with the angular filter for dates, which simply stop working, so we added another library called angular-moment to deal with that. So the code for the input that shows the date ended being this:

  

Further action: Doing some more testing we discovered that by using moment.utc() we don’t really need add moment-timezone or do the setDefault(“Etc/UTC”) thing. We have not given this a huge amount of testing, but the code would look like this:

 


Studying for Microsoft Exam 70-461

This month myself and the other Dovetailers took some Microsoft Certification exams.

I took the exam 70-461: Querying Microsoft SQL Server 2012/2014.

With that in mind I thought I might share some thoughts on my exam preparation and on some of the resources I used in preparing for the exam. I must say that I was not very proficient with SQL before studying for this exam but with the right amount of preparation and study I passed and earned my certificate.

Below is a list of what I did while preparing for the exam

  • Studied from different resources books, video courses and practice exams.
  • Find which kind of study material suits you more.
  • Study over a period of 4 months.
  • At least 30 minutes study every day.
  • Try and study in the morning. I found it hard to study in the evenings.
  • Take practice exams.
  • Study the exam objectives.
  • Once you feel ready, take the exam.

Below is a list of Study material I used and my thoughts on them

Books

The book I studied with was "Training Kit (Exam 70-461): Querying Microsoft SQL Server 2012 by Dejan Sarka, Itzik Ben-Gan, and Ron Talmage".

This is the official book for the exam. It is a detailed book and covers all the exam objectives. It also covers more than the exam objectives all of which was interesting and will prepare me for the next SQL exam. The book contains around 700 pages. 

The book comes with a free practice test but this was not as good as the practices exams provided by Measure Up and Transcender.

Video Courses (70-461)

Pluralsight : The course was a bit too short and the instructor does not go through the topics thoroughly . I felt it best as an introduction to the exam.

Joes 2 Pros: Very good material, the instructor goes into every topic in detail and provides labs for practicing as well. The website is kinda clunky but the videos are good.

CBT Nuggets: Alternative to Joes 2 Pros, it does not go into the same depth as them but a it does cover a lot of the topics. Provides a lab for you to practice with. The free trial only lasts 7 days.

YouTube: There is a SQL Server tutorial playlist, which covers more topics than whats on the 70-461 but a good free resource.

Practice Exams

Measure Up: The interface did not properly format the SQL, so it can be quite difficult to read. A part from that the exams were useful.

Transcender: I really like Transcender, the interface is good and they also provide flashcards which were helpful when trying to understand an exam topic when needed. I found this to be a really useful tool when studying. The exams were as good as Measure Up and the type of questions asked were of a similar structure to the real exam.

I hope you find this blog post helpful in preparing for your 70-461 exam.

Good Luck!

 


Olá Dovetail

Hello, my name is Murilo André da Silva and the I'm the newest international addition to Dovetail. I've been working here part-time since May while I was finishing my English studies and also bringing Coxinhas to the big bosses. In the end they liked the "Brazilian fried chicken things" so much that they decided to hire me.

I'm from a small (by Brazilian standards) city in the south of Brazil called Foz do Iguaçu. It is famous for the Iguazu Falls:

undefined

Before coming to Dublin I was working for SOFT-TI Informática as a Web Developer. Most of my experience comes from working with the .NET Framework, specially with ASP NET MVC applications. 

I'm really enjoying my time here at the company and I feel that the future here for me is very promising.

 

 


  • 1