Travis and Circle: test automation and reality of CI

Why u do this?
Why u do this?

I guess it’s time to do some sort of benchmarking and evaluation on test automation we started to use recently in the company.

*Captain Obvious mode on*

For those companies/developers that still haven’t figured out what’s test automation (front-end/back-end, TDD, BDD, etc) and continuous integration –  guys, you’re doing it wrong. Yeah, I know, I know that “everything works fine for us and there’s no need to waste more money for things we don’t use”.  By the end of the day it’s your time you’re spending on doing things we stopped doing at all focusing on more important things.

Here, I should’ve started explaining you that CI is a money saver in complex projects, when you can iterate faster with production systems increasing the responsiveness of your product/service. Setting up CI infrastructure and pipelining the project/task management is closing down the topic of “D-days” for the projects and all that pressure on the team once you release.

But, I’m pretty sure that you all know about that!

*Captain Obvious mode off*

Coming back to some basic comparisons on Travis and Circle, you won’t find in this post a massive judgement on what’s better. Working with WHMCS-API gem I’ve used Travis-CI for test automation.

Stating that Travis and Circle are interconnected with Coverall, GitHub, Zapier, Asana, and other great services – out of comparison list. It’s just there – live with it and be happy!

Speed performance fully depends on the type of tests you have and level of their complexity. Comparing Ruby gems we test on Circle and Travis – I’d recommend Travis – config file is few lines shorter. Comparing the list of supported languages, platforms – definitely Travis, but I guess it’s the matter of time when Circle gets there.

What was chosen for the next few quarters:

  1. Travis-CI remains for now a a service where we release our open-source projects to do the tests and CI in the company
  2. Technology we use is fully supported by both – thus services can be swapped any time.
  3. Task management is streamlined from “Task given” to “Task deployed, tests ran, check the diff and deploy once feel like it”.

Next time I’ll grumble about something less tech’y.

WHMCS API: heritage of whmcs-ruby gem

Joshua Priddle did a great job back in DotBlock accomplishing Ruby binding for WHMCS API.  Unfortunately, last signs of activity were 3 years ago. It’s a pity, as gem is great, and works like charm, but it became massively outdated, and piled with pull requests no one merged in the master branch for ages.

The code was published by MIT license on 2011, thus whmcs-api gem will be its descendant, which I’ll try to keep updated as much as possible.

For now it’s being tested on Ruby 2.x and WHMCS 5.3.x without any problems. The source code and any issues are better be reported on the Github repo.

 

Punycode domains: why?!

why

Honestly, I couldn’t get the idea of non-latin alphabet used in domain names. Especially when the standards were passed, and Registrars started offering cyrillic, arabic domain names, but web browsers still were preferring to output it as a punycode mess.

A pretty simple cyrillic domain like ‘президент.рф’ (stands for president.rf) becomes ‘xn--d1abbgf6aiiy.xn--p1ai’. Not all the browsers still keep cyrillic domains in the address bars, so you’d see some punycode mess in there.

Ugly indeed, and not really useful, so for fast domain unicode/ascii checking that all of them are properly synced, got this tiny script:

How bad is your Change Risk Anti-Pattern index?

Measures the C.R.A.P. (Change Risk Anti-Patterns) score. It is designed to analyze and predict the amount of effort, pain, and time required to maintain an existing body of code.

A method with a CRAP score over 30 is considered CRAPpy (i.e., unacceptableoffensive, etc.).

 C.R.A.P.(m) = comp(m)^2 * (1 – cov(m)/100)^3 + comp(m)

Where comp(m) is the cyclomatic complexity of method m, and cov(m) is the test code coverage provided by automated tests.

Slack: team communication

Slack: communication tools
Slack: communication tools

This is just a perfect example of B2B communication tools. Free to 8USD/mo+ is more than enough to setup a standard communication tool in a small company (i.e. startup, or SMB) just to cut the never ending story on xmpp/skype/email/etc.

And as any geek, they got me on “integration” section:

  • GitHub
  • Asana
  • Dropbox
  • Nagios

For those who’s got a missing bit of team communication in their shipping/communication chain for product delivery. This one’s for you folks!

Friday pint talks with fellow inhouse developers

X:- Hey, we’ve recently launched a cool piece of NDA in our proprietary NDA.
Y:- Sounds great. How did you manage to prototype it?
X:- Well, we took some NDA, with NDA, cuz the first one had some problems with caching, and with some NDA, we got this NDA to work!
Y:- Why did you use this NDA, when NDA we use in the company does NDA better, it’s more NDA, NDA and NDA that this!

Open-source helps people socialize! 😉

SQL reinsert row in the same table

Seems that we have a competitor to “export to csv” sql query that I keep forgetting every time I need to export something in the CSV file.

The second nominee is reinserting the row into the same database but with a new primary key.

# YOURID - source record
# yourtable - target table;

CREATE TEMPORARY TABLE tmp_table SELECT * FROM yourtable WHERE id=YOURID; 
SELECT @new_id:=((SELECT id FROM yourtable ORDER BY id DESC LIMIT 1) + 1); 
UPDATE tmp_table SET id=@new_id WHERE id =YOURID; 
INSERT INTO yourtable SELECT * FROM tmp_table WHERE id=@new_id;