Posted in scripting, Unix

Unix and friends

UNIX

Knowing Unix command line is definitely not something that you’ll impress a nice girl, but it might be something that you’ll impress cute geek guy 😉

What is Unix

As I wrote before  Unix is a family of multitasking, multi user computer operating systems. I was told that my definition was not precise enough, so for those of you, who are completely not familiar with Unix, I’ll repeat:

Unix is a OS (Operation System).

It is not a tool.

It consists of large number of tools.

It’s like a mother-ship for other OSes (such as Linux or you’re favorite Mac 😉 ).

In order to talk to Unix – you’ll need to be using the command line.

(I hope this time it was explicit enough :)).

crVtQK

Moving on

In Unix-like systems the commands are quite often nothing else but tiny programs, which run from command line. They are form of shells. Most of the shells can be also used as scripting language, which enables the user to perform multiple tasks and write scripts to automate repetitive activities.

There is several scripting languages available (csh, ksh, bash). As far as I know, one of the most popular in Unix is bash.

Before you start a little chit chat with your console – it is good to know the basics – and what I mean by that is to read about FHS – Filesystem Hierarchy Standars. Unless you won’t be a smart-ass.

FHS is common for Linux and Unix systems.

Examples

Having said that, let’s move on to the most useful commands that allow you talk to Unix.

One of the cutest commands I’ve ever seen is whoami. It is a real command. It doesn’t mean that Unix would reveal the secrets of life in front of you, but after several hours of coding it is good to know your name, right?

What might be more useful in real life? What do I use on daily basis?

bash  – switch scripting language to bash

pwd – show current directory

cat   – show file content

cd    – change directory

/       – hint – in Unix (in a contrary to Windows console) we use / instead of \

cp  – copy

ls   – list

ls -l   – list with rights – this command shows hidden rights to the files inside current catalog

 -a   – list hidden files

ln  – create hard link

rm – remove file or catalog

chmod  – adding/removing rights to the files

-al      – show hidden catalogs

history – this one fellow might be useful at the beginning – it lists all previous commands

Please try it at home. Next time we’ll play a bit more with Unix. I’ll show you some tricks.

As usual, stalk me on Twitter – all of your comments are very welcome.

Cheers!

Posted in Uncategorized

Happy Eastur

159554bf3fb6b0e7f9e5688574c58c0b

Hi Boys and Girls,

Today it won’t be technical or QA-ish at all.

Today is my birthday and Easter started at the same time.

It’s raining in Wroclaw and apparently there is no spring at all…

HOWEVER!

I would like to wish you all the best and simply thank you for being here and reading my blog. Each time I post something I am surprised by the number of people visiting this space.

Thank you,

Peace and love,

Winnie’s the Pooh “Happy Eastur”.

Next time I’ll go back to Unix, promise!

:q!

IMG_-f3gh6a

 

Posted in scripting, Unix

VI – Very Interesting text editor

Tenha uma

Hello Boys and Girls

As I promised, I would share all knowledge I gain, as it might by useful for any of you (either tester or not).

Last time we were talking about basic concept of Unix. It would be great to be able to talk to it, wouldn’t it? 🙂 In Unix and Unix-like systems all commands are run from command line in some script languages. There is few of them, but bash seem to be most recommended. But it is not language that we will be talking about today.

Today we will be editing files.

From command line.

In Unix.

Like… really.

What is VI

There are some editors that enables you to manage files in Unix.

Editing files using the screen-oriented text editor vi is one of the best ways. This editor enables you to edit lines in context with other lines in the file.An improved version of the vi editor which is called the VIM.

Let’s start from basics.

The name “vi” is derived from the shortest unambiguous abbreviation for the ex command visual, which switches the ex line editor to visual mode. The name vi is pronounced /ˈvˈ/.

You have a file – let’s assume it is some shell script (sh) – a file that was written to run some process. You are able to see (edit) it in your Notepad ++ (I need to write about it too), but it’s not the point. You can be a smart-ass and edit it directly in Unix – using VIM. How to do it?

Open your Unix console -> Find the file location -> type vi NameOfTheFile.sh -> Click Enter.

1Tadaaaaam 🙂

Piece of cake.

Vimtutor

For those of you, who are really interested in getting familiar with vim – there is an awesome built-in solution. It’s called vimtutor. Type vimtutor in your console, click Enter, and you’ll have access to set of easy lessons which give you some basic abilities.

VIM is a bit like Agile for V-lovers – You have to unlearn what you have learned. Nothing there is as you assume it would be – for instance moving up and down in the console bases on 4 keys:

k

h                                                                                                                                    l

j

 

It is so straight-forward to remember that l is a shortcut for right 🙂 Right?

First thing to remember is how to get out of vim

:q!

Those 3 keys may save your life.

Hints

To be honest, vim is useful, especially, when you are working with number of files, have to edit them and basically move around. It helps. It might be colorful, if you wish and it does it’s job.

Useful hint: VI is case-sensitive. It means that you have to be careful what you are writing. :Q! won’t get you out of there 🙂

Vim works in two modes:

  • command
  • insert

To proceed any operations – you have to be in command mode. In order to do so – press Esc twice.

To edit your file and change text inside them – you have to be in insert mode – when you want to switch to it –  i (insert) or a (append).

Inside vi you don’t have to press Enter to confirm your operation (that is also a useful hint).

938f75ace142cfa0b22b4dbe5cc558a3

Commands and descriptions

 

What might be useful for you at the beginning of playing with insert/append mode:

  1. Editing files

i – Inserts text before the current cursor location

a – Inserts text after the current cursor location

A – Inserts text at the end of the current line

p – Pastes a new line

 

       2. Changing files

x – Deletes the character under the cursor location

X – Deletes the character before the cursor location

dd – Deletes the line

dd<10>– Deletes ten lines at once , starting from the place where cursor points

u – Undo of the last command

>Moves text to the right

< – Moves text to the left

yy – Copies the current line

 

What might be useful for you at the beginning of playing with command mode:

:q! – Leaves the editor without saving

:w – Saves the file

😡 – Leaves the editor with saving

:help – Helps you

:e name – Opens file for editing

 

And couple of my favorites:

:set nu – Sets the number for each line in the file (eases searching through logs a lot,                            believe me)

/              – searches through pattern – for example /Setting

:10,30s/^/#/ – an example of how to comment lines from 10 to 30 (you can try any other                             combination on your own)

 

The vi has the capability to run commands from within the editor. To run a command, you only need to go to the command mode and type :! command.

VI runs on every Unix environment without any additional packages or libraries. It gives you the opportunity to work with your files even the the connection and editing environment are rather poor.

I hope that set of hint will be useful for you. There is plenty of online guides and examples how to play with vi. Don’t be afraid and remember – if I was able to do it – you are capable of it to.

Enjoy!

Posted in databases, Unix

Introduction to Unix

One day this unexpected situation comes.

This is Linux.

This is your console.

We use Unix.

Enjoy.

introduction

It wasn’t that bad:) Fortunately, I’ve received a good companion to get familiar with Unix and not to drown. Let’s get to the point.

What is Unix

miniux

For those, who use Windows on daily basis it might be surprising. Sure we are aware that there is something more out there (like Mac 🙂 ) but Unix? Linux, Unix, they are operation systems just like your beloved Windows 🙂

Traditionally, let’s start from Wikipedia’s definition:

Unix is a family of multitasking, multi user computer operating systems that derive from the original AT&T Unix, developed starting in the 1970s.

You may be familiar with Linux, Unix is a bit similar. They have common source and behave in a similar manner.

Linux is a pure Kernel – Unix consists of Kernel and some additional software. Linux is free – Unix – in most cases – is not 😦 What is more, Linux, originated from a programmer’s toy – became a powerful tool for large machines. Unix though, starting from exclusive , expensive environments, nowadays is used on small PCs.

What you have to know – there are different types of Unixes. They are comparable, but not exactly the same. To talk to Unix you need to get familiar with any shell.

Why do we need them anyway?

We need Unix in order to work on remote desktops – or – to enable multiple users to use one space. What is more – each Linux/Unix enthusiast would tell you that it’s reliable. They won’t prompt you seven times if you REALLY REALLY wanna delete this file, but at the same time, they won’t run an update in the middle of conversation 🙂

Unix is a common “tool” used by large companies. It is very useful in working with databases.

You have to make some effort to get familiar with console and simple script languages, but if I was manage to do so – you’ll be able to to that for sure:)

In my next posts I would go a bit deeper into subject and move on with simple commands, that are useful for me in testing activities and managing files.

Here you can find more complex information about what Unix is.

As always – I recommend you to install it by your own and just play around. You could also get familiar with Unix with this simple course from Codeschool here (no, the don’t pay me, they just have awesome courses) .

Stalk me on Twitter. Enjoy. 🙂

Posted in test automation

It is (sometimes) a good idea to automate your regression testing

 

Desejando-lhe uma

Let’s start from Wikipedia’s definition of Regression Testing:

Regression testing is a type of software testing which verifies that software, which was previously developed and tested, still performs correctly after it was changed or interfaced with other software. Changes may include software enhancements, patches, configuration changes, etc.

Now, when we are aware of what is all about, let’s get to the point.

How often do you proceed regression testing? Once per sprint? Once per month? Daily?

Here we are. If our regression testing is supposed to make any sense – it has to be performed as often as possible – at least on sprint basis. Ideally – daily. Why? Because  stable test suites would catch any unexpected system behaviors and react to a major change.

Minions-at-work

There is yet another question – how big your system is.

Small systems usually have rather checklists than test suites. Large ones – even the monsters:)
Deciding what should by automated  is always tough, because having automated test scrips may be just something you could show off with or present in front of the customer. I would rather ask: WHY do you want to automate anything?

The problem is that sometimes automated suites don’t test anything (or anything meaningful) and the effort to keep them alive is big.

If you wonder if it’s worth to automate repetitive stuff? I’d answer – sure mate!

Automation is good. But it is just another tool – NOT THE PURPOSE.

AUTOMATION

I think that automated regression tests might be brilliant and helpful, but you have to remember that you’ll have to take care of them and update them often. You’ll also spend way more time to prepare test suites than to proceed simple tests manually, so if the testing is not repetitive – it’s good to calculate what is more beneficial for your project.

When automating things – you improve your skills and gain time for other activities – so it’s basically a matter of time – the time you’ll save on running automated regression testing and time you’ll waste (it’s not wasted, I know) on preparing them.

I’m just the beginner , so I might be wrong. Don’t agree? Comment below or stalk me on Twitter.