Categoría: SWQT

In this blog post I will include my thoughts about the classes TC3045 (Software Quality and Testing) and CB00881 (Smart Citizens)

First of all, these were my first and last classes (because I’m graduating and I’m not planning to do a Masters) using the Flipped Learning method. I found it very interesting because I had a lot of flexibility in terms of homeworks and tasks, at the start of the semester I was working in a full-time job so I have the option to complete all my pending assignments in my free time. To be honest, I should have been more careful about the deadlines and deliveries because I have a considerable amount of accumulated tasks to do at the end of the semester.

About the content of the classes and assignments, they met my expectations, there were some assignments that challenged myself and taught me new things. At the start of the semester, we have to write blogs weekly for CB00881, I wrote a few on time because I don’t have the writing habit developed, I don’t really like writing so much, but I want to. Recently I started to read more blogs about the new technologies, the updates and improvements in the actual ones, and some tutorial blogs to develop something using a language or framework. I want to share some knowledge to the world and start writing some blog stuff and link the code I used to my GitHub repo, I proposed myself that I want to contribute to some Open Source repos in order to thanks all the amazing people that are doing it and all the times I used those repos. I hope I will do it.

Ken is amazing teacher, he really knows how to transmit his knowledge and encourage you to learn. But apart of being a good teacher, he is a great human being, he is always open to talk to you about your thoughts, life, work, feelings and whatever you want, he will listen and he will be there to help.

Two weeks left in the semester and then exams for my @TecdeMonterrey students. Take care of your health: sleep, eat properly and ask for help if you need it. My door is always open in person or online. If you are hungry and don't have money to buy a meal, I will buy you one. pic.twitter.com/OfTEmhuY8X

Preparing VirtualBox for running Ubuntu

Launch VirtualBox and select “New”, the next prompt will appear. Make sure you select Linux and Ubuntu (32|64-bit) version.

Set the RAM

Select the Hard Drive Type

Your VM is almost ready, when you boot it from the first time, it prompts you to select the bootable file, make sure you select the *.iso file you downloaded from the Ubuntu webpage.

Follow the instructions prompted by the OS like creating an Username and Password, when it finished, we’re going to install the required packages for running Node.

Installing NodeJS & Git

First we need the curl package, open the Terminal app and type

sudo apt-get install curl

Next step is to download Node source, type the following command

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -

Once finished, let’s install NodeJS by running the next command

sudo apt-get install -y nodejs

Finally, verify that node and npm are correctly installed by checking the version of each one

node -vnpm -v

Our next step is to install git, so we run the next command

sudo apt-get install git

And like node and npm, let’s verify the installation by checking the version

git --version

Now let’s create a repository for serving a simple webpage using node and express. In a new folder run npm init, and fill the prompted options. This will let us install node packages using npm. Install express by running npm install express. Let’s write some HTML and JavaScript.

index.htmlindex.js

In the package.json file, add a new script for running our development server.

"scripts": { "start": "node src/index.js" }

Run the script typing npm run start and open the browser in http://localhost:8080, you should see the following

It works!

Remember to add git to the project.

Now, we’re going to write a small cron job in our Virtual Machine, type the following

crontab -e

Select your desired terminal editor and you’ll be able to edit or add cron jobs

At the end of the file we will write the cronjob, add something simple like this

* * * * * echo 'Hello Cron!' > $HOME/cron.txt

This task will be running every minute and overwrite the file with ‘Hello Cron!’, close the file and save it. Next go to your home directory in one minute and see that the file is created

Amazing! We wrote our first cronjob in Linux. This is the part II of a series of five posts

Testing the code is a fundamental part while developing an application, it ensures maintainability, usability and scalability. There are several test tools and frameworks for every ecosystem and programming language that makes the stage of deploying easier.

The method of “test && commit || revert” described by Kent Beck, called my attention, because it enforces the developer to write good tests because if a tests fails it returns the code to the last green commit (all passing tests), that’s why it has to check the code meticulously to ensure it won’t fail and also to save the last state of the code where it worked perfectly. Basically the command runs the nexts operations.

git commit -ma "Test worked" // if passedgit reset --hard // if not

In the experience I had testing my applications it always has been present the part that I do the commit, and then the tests fails in an specific case, so I go back and fix it, and then commit again but because of that fix another part crashed, and so on and so on, so definitely I will try this technique for making me more productive.

An area that is very important for me in the team is the DevOps, it’s impressive how you can speed the development and deployment of a project when you have a well structured CI/CD. I have a little experience in the DevOps area, setting up the CI/CD scripts and the pipelines for the VCS. It is very delightful seeing the tests passing in a deployment process, making newest versions of the application more maintainable and ready-to-deploy. DevOps is an area that every software company has to have.

Next step is to run our tests, go to package.json, and add the “directories” property if not set already. Inside directories, we add another key named “test” that will have the value of the directory where we are saving our test files. Also, we need to add our test script, that will be just “mocha”.