Install Docker on Ubuntu 18.04

Posted on by 0 comment

Docker is very popular tool which creates container in the application development, same software, configuration will be packaged and used for testing and production.

In this exercise, we will install docker in a Ubuntu server

Check Ubuntu version

lsb_release -a

No LSB modules are available.
 Distributor ID: Ubuntu
 Description:    Ubuntu 18.04.3 LTS
 Release:        18.04
 Codename:       bionic

Update package

sudo apt-get update 

Remove old version if exists

sudo apt-get remove docker docker-engine

Install Docker

sudo apt install 

Auto start Docker service

sudo systemctl start docker
sudo systemctl enable docker

Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
 Executing: /lib/systemd/systemd-sysv-install enable docker

Check Docker version

docker -v
Docker version 18.09.7, build 2d0083d

Hello world

docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.
Category: Docker

Api test automation with mocha and chai

Posted on by 0 comment

Mocha is a JavaScript test framework running on Node.js and in the browser, which can be used for unit testing, and api and ui automated testing, here we will use it along with chai to do some api automated testing in nodejs with typescript.


We will install packages below with yarn add or npm install

  • @types/chai-http
  • @types/mocha
  • @types/node
  • chai
  • chai-http
  • mocha
  • mochawesome
  • ts-mocha
  • ts-node
  • typescript
  • typings

Writing tests

Mocha BDD interface will be used to create the test case. chai-http

describe('test get findByStatus', () => {

    it(`should succeed when findByStatus`, (done) => {


describe('test get findByStatus', () => {

    it(`should succeed when findByStatus-async`, async () => {
        const res = await chai.request(baseUrl)



Data driven

We have created one test case, but we have some more status to check, so let’s make it data driven.

describe('test get findByStatus', () => {

    var tests : {status:string, expectedCount: number } [] = [
        {status:"available", expectedCount:1000},
        {status:"pending", expectedCount:300},
        {status:"sold", expectedCount:500}

        it(`should succeed when findByStatus - ${test.status}`, async () => {
            const res = await chai.request(baseUrl)


Execution and reporting

//Add content below in the scripts section of package.json
"test": "ts-mocha --file src/test/tw.test.ts",
"test:report": "ts-mocha  --reporter mochawesome --file src/test/tw.test.ts"
Category: javascript

Reading and writing serial port data with PowerShell

Posted on by 0 comment

List com ports

To see a list of available com ports,

Read or write data

To read or write data with given details, such as port, Baudrate etc.

Write unix time

I have a clock which accepts unix time for syncing the time, so I use script below to sync the time if the clock being off for few minutes after some time.

Category: PowerShell, uart

Download UFT script from ALM

Posted on by 0 comment

Usually we use ALM to manage our test cases, test script and resource files, which works very well, but when we consider to host the script in git, we have to download them to local and commit to git.

In this exercise, I try to download UFT scripts and resource files in UFT with using ALM OTA , the OTA api reference can be found here, and here is the code.


Category: UFT

Firebase login in docker toolbox

Posted on by 51 comments

The exercise is trying to resolve the Firebase login callback issue in docker; my system setup is VirtualBox with Docker toolbox.
Let’s start with the login command:

Then I copy the long URL, and paste it to a browser window in host machine, allow the FirebaseCLI access, the authentication is working fine, but failed at callback. That is due to the setup is docker with VirtualBox, so localhost is not same as the docker machine, which in my case is, and HTTP://localhost:9005 is not accessible. If I try to modified the URL with replacing the localhost with docker machine IP, a 400 OAuth2 error will be returned.

After some trying, and managed to get it working with steps below,

  • Copy the long URL and paste it to a browser window in host machine
  • Follow the steps to complete the authentication
  • The callback failed with URL HTTP://localhost:9005?state=…..
  • Replace localhost with the docker machine IP in the URL and click enter

Now you will receive a successful message in the browser window and docker terminal.

Category: Docker