Category: Beginner

Explained in an easy to understand way. Check out our articles for beginners!

Super Essential Ubuntu Terminal Commands

Super Essential Ubuntu Terminal Commands

Recently I started setting up Jenkins server in Ubuntu 16.04.3 machine. Check out this article if you are interested in the Ubuntu Jenkins master setup. I will start with the Ubuntu terminal commands that I found super essential.

Folders and files manipulation

man Display help for any command. Example: man ls

lsLists current folder contents.

cd /var/lib/jenkins Change the current directory to /var/lib/jenkins. I found it very confusing initially that in Windows the paths are with back slash \, but in Ubuntu the paths are with forward slash /.

cp -a /foldertocopyfrom/file /foldertocopyto Copy files or folders. You should have permission for the destination folder.

sudo rm -f jenkins.logDelete the file jenkins.log.

sudo chown -R jenkins:jenkins /var/lib/jenkinsChange the owner of the directory /var/lib/jenkins to user jenkins and group jenkins. R option will change the owner recursively for all folders and files that are inside the specified one. Useful when you receive Access Denied error.

sudo chmod -R 644 /var/foldername 777 code would mean that you give access to everyone to read and write in the folder, which is generally a very bad security practice. You can read more about permission codes here.

stat /var/lib/jenkinsDisplay infomation about the owner and permissions for the file or folder.

Packages

sudo apt-get install jenkinsInstalls the package jenkins.

sudo apt-get install jenkins=2.89.3 Just put your preferred version in the place of 2.89.3.

sudo apt-get update Updates all packages.

sudo apt-get upgrade Upgrades all packages.

sudo apt-get upgrade jenkins=2.89.3 Upgrades package to a specified version.

jenkins --versionSee the Jenkins server version.

lsb_release -a Display the Ubuntu version.

whereis gitDisplay git location

Jenkins Service

sudo service jenkins start Starts Jenkins service.

sudo service jenkins stopStops Jenkins service.

sudo service jenkins restartRestarts Jenkins service.

sudo service jenkins status Shows Jenkins service status.

Monitoring

watch -n 5 free -mSee used and free RAM memory.

df -hSee hard disk usage.

sudo du -hxd 1 / 2>/dev/null | sort -hrDisplay hard disk usage sorted by folders size.

timedatectlCheck date and time and if there the time is not correct use:

sudo timedatectl set-timezone EET Put your time zone in the place of EET.

sudo rebootWhen you see message “System restart required”, it is time to reboot your machine.

Summary

If you receive unexpected error when you are entering commands in the terminal, you could remember case sensitivity could be the issue. For many of the commands you may need root access. If this is the case put sudo (SuperUserDo) before the command.

I presented you Ubuntu terminal commands that I find most essential and useful. They are a great start for your Linux Ubuntu journey.

Easy XPath Expressions

Easy XPath Expressions

Tangerine Peeled
XPath is a language that helps you navigate through XML (eXtensible Markup Language) documents. Website pages contain HTML, which is an XML like language. For automation purposes such as locating HTML elements you can use XPath. Many colleagues prefer to use id and this is quite OK as long as the id is present for the wanted element and it is not dynamic (it does not change). You can also locate element by several other options, including class, tag name, href or other suitable attribute. However there are many elements that could be uniquely identified only by XPath expression with multiple conditions. In this article we will start from basic expressions and we will finish with more advanced ones. The page that I used for testing the expressions below is located at https://qamag.net/wp-content/uploads/2017/12/XPath-Test-Page.html.

XPath Expressions

Find element by id expression if you want to match the exact id:

The following expression will match the div with id that is exactly primary:

//div[@id='primary']

You expect the id to be unique? Unfortunately this is not always true. Verify that only one element is matched.

Here is the expression if you want to match a part of the id:

The following expression will match the div with id that contains primary:

//div[contains(@id,'primary')]

Find element by exact class:

The same is valid for classes. The following expression will match all elements with class that is exactly site-main:

//*[@class='site-main']

The asterisk matches all elements, no matter what is the tag name (div, p, a, main, etc.).

You can locate element by partial class:

//div[contains(@class,'content-area')]

//div[@class='content-area'] will return 0 matched elements because the exact match will not select element with class col-md-9 content-area.

Find element by exact match of inner text:

//a[text()='Awesome Online Resources for Software Testing'] returns exactly one element.

Locate element by partial match of inner text:

//a[contains(text(),'Awesome Online Resources for Software Testing')] returns exactly one element.

Find element by attribute:

This expression finds 5 elements:

//a[contains(@href,'awesome-online-software-testing-resources')]

We could get the first of them by adding the element position in brackets:

(//a[contains(@href,'awesome-online-software-testing-resources')])[1]

Of course we can use exact match expression:

//a[@href='https://qamag.net/awesome-online-software-testing-resources/'] finds 4 matches.

Find element by tag name:

//h1 is unique for the test page, which is a good thing, more than 1 would mean we could have SEO issue.

Let’s start with more advanced expressions.

Translate

There is a nice translate option that you can use if there is a letter with different capitalization. The following expression finds all elements that contain text online, no matter of the letter  case.

//*[contains(translate(text(), 'ONLINE','online'),'online')] finds 3 matches in our test page.

Normalize space

//*[contains(concat(' ',normalize-space(@class),' '),' btn-default ')] finds  7 matches because it trims the white-space.

//*[contains(@class,' btn-default ')] returns 0 matches, because the white-space is not trimmed.

Starts With

//a[starts-with(@href,'https://qamag.net/awesome')] returns all anchors (5 matches) that have attribute href, starting with https://qamag.net/awesome.

Currently ends-with is not working for the expressions I have tested with, because of the XPath version. For more details, please check this stackoverflow answer.

Or

Or acts as union of the elements that are returned from each part of the expression.

//*[contains(@rel, 'bookmark') or contains(@id, 'main')]triggers 22 matches. The expression returns all elements that either have attribute rel that contains bookmark or have id that contains main.

//a/ancestor-or-self::article | //footer returns 14 matches. They are elements with tag article that are ancestors to anchor elements or elements with the tag footer.

And

The following expression returns all elements (1 match) that have attribute rel that contains bookmark and contains the text Awesome.

//*[contains(@rel, 'bookmark') and contains(text(), 'Awesome')]

The same is achieved with the expression:

//*[contains(@rel, 'bookmark')][contains(text(), 'Awesome')]

Not

The following expression find the element h1 if it does not contain class logo and does not contain class hidden.

//h1[not(contains(@class, 'logo')) and not(contains(@class, 'hidden'))]

The same is achieved with:

//h1[not(contains(@class, 'logo'))][not(contains(@class, 'hidden'))]

Every nth element

(//a[contains(@rel, 'bookmark')])[2]returns one element, whereas //a[contains(@rel, 'bookmark')][2] returns no elements. This is because [] has precedence over // operator. For more details please check this stackoverflow answer.

Find the parent element that has child element that meets certain conditions

Descendant

//h2/a returns anchor element that is direct child of h2, whereas //h2//a returns anchor element that is just child in h2, could be direct or indirect. It is the same as //h2/descendant-or-self::a

The following expression finds the anchor element that is descendant of h2 element and that contains the text Awesome Online Resources for Software Testing.

//h2//a[contains(text(), 'Awesome Online Resources for Software Testing')]

The following expression returns the h2 element that has descendant anchor element that contains the text between the single quotes:

//h2[descendant::a[contains(text(), 'Awesome Online Resources for Software Testing')]]also returns the same h2 element  in our test page as:

//h2[@class='entry-title'][.//descendant::a[contains(text(),'Awesome Online Resources for Software Testing')]]

Parent

//a/parent::article returns the article element that is a parent of an anchor element.

Both single and double quotes could be used in XPath expressions. I personally prefer single quote syntax, because in C# you use double quotes for strings and if you have double quotes in the expression you should escape them in the C# string.

Ancestor

//a/ancestor-or-self::articlereturns the article element that is an ancestor of an anchor element.

Sibling

The following returns div element with partial class entry-summary, which preceding sibling element is with header tag, with exact class entry header.

//div[contains(@class,'entry-summary')][.//preceding-sibling::header[@class='entry-header']]

//h2/following-sibling::div returns div element that is the following sibling of a h2 element.

Several conditions combinations

Try to predict what will return the following expressions, without looking at the answers a little bit below:

  1. //a[@rel='bookmark'][contains(text(),'Online')]
  2. //div[contains(@class,'content-area')]//a[contains(@href,'online') and contains(text(),'Awesome')]
  3. //header[.//descendant::a[contains(text(),'Highlights') or contains(text(),'Awesome')]]
  4. //article[(contains(@class,'type-post') and contains(@class,'tag-conferences')) or not(contains(@class,'category-resources'))]

Answers:

  1. Returns an anchor element that has attribute rel that equals bookmark AND contains text Online.
  2. The result is an anchor element that has parent div with partial class content-area AND contains partial href online and contains text Awesome.
  3. Returns header element that has descendant anchor element with either text Highlights or Awesome.
  4. As a result 7 article elements are returned that meet the three class predicates – two positive and one negative.

Test XPath Expressions

You can use browser developer console, browser plugin or online resources to test your XPath expressions.

Most of the time I test XPath expressions in the Chrome developer console. In order to do this, follow the steps:

  1. Open in Chrome the page used in this article for testing expressions https://qamag.net/wp-content/uploads/2017/12/XPath-Test-Page.html  or any other page you want to test with.
  2. Press F12.
  3. Ensure you are at Elements Tab (It is shown by Default).
  4. Press Ctrl+F.
  5. Enter or paste your expression in the input that appears, and if there is a match, the first element that is matched will be colored in yellow.

Test XPath Expression Chrome Dev Console

Relative XPath Helper and XPath Helper are useful and easy to use Chrome extensions for testing and generating of XPath expressions with simple mouse clicks.

You can also test online expressions on https://scrapinghub.github.io/xpath-playground/ or on https://www.freeformatter.com/xpath-tester.html.

Summary

XPath expressions add flexibility in locating elements. Usually there is more than one expression, that is readable, flexible and identifies uniquely an element. We need this in order to have stable and easy to maintain automation tests.

Great Browser Extensions for Website Testing

Great Browser Extensions for Website Testing

ToolsIn this article I will present you more than 20 browser plugins that I find most useful for testing purposes. Most of them are Chrome extensions, the others are Firefox add-ons.

Visual Testing

Design Testing

You can use Window Resizer for testing responsiveness of a web page. Although it is easy to use, I prefer Chrome developer console for this purpose. This article explains shortly how you can do it, along with starting steps for several types of testing. I like the predefined dimensions with real devices names. You can use the developer toolbar even in incognito mode without additional setup, whereas to use other extensions you should first allow them to run in incognito mode through extensions options.

Chrome Dev Console Device Mode
Page Ruler is Chrome extension that allows you to measure elements on a web page.

PerfectPixel is Chrome and Firefox extension. Allows you to load picture as a layer and to compare it with your current web page. Useful when you test for pixel perfect implementation of design.

Colorzilla is Chrome and Firefox add-on for getting color from web page.

WhatFont is plugin for detecting the fonts used in a web page.

Grammarly for Chrome helps you test content and find spelling and grammar errors. You need to register, sometimes it slows your page, but it has a short learning curve.

Pushbullet is Chrome and Firefox extension for syncing data between devices. I use it when I test design of a page with long URL on different devices. I send the URL from my Chrome browser and then I receive the same URL on the mobile devices that I test on. Initial setup can be time-consuming as you should install Pushbullet application on all your devices, but it is worth it.

Screenshots

Grab Them All is a Firefox plugin, I make screenshots of multiple web pages with it. I am not aware of plugin with similar functionality for Chrome. Unfortunately Grab Them All plugin is not compatible with Firefox Quantum. Full Page Screen Capture captures full page screenshots, but does not have the feature I value most. Grab Them All the most awesome feature is that it accepts input file with URLs and name of directory where the screenshots will be saved. You can specify the dimensions for the screenshots. You can capture both the visible and the parts of the web page that are accessible via scrolling.

Grab Them All Firefox Plugin

To see the options menu, go to Firefox Add-ons.

Grab Them All Plugin Options

Click Options on the Grab Them All row and you will see the menu:

Grab Them All Plugin Options Menu

Jing is a desktop tool for making screenshots and short videos up to 5 minutes. You should make an account with screencast.com if you want to share them.

Links Testing extensions

LinkClump is Chrome extension for opening multiple links. I like it because I don’t need to click every single link manually. Just draw a rectangle and the links in it are opened. Add-on with similar functionality for Firefox is Snap Links Plus.

I like Link Klipper for its ability to extract and export links from page.

Tab Snap Chrome extension would be helpful for you if you need to get all your open browser tabs URLs. Also if you want to copy URLs from your file and open them all.

Firefox Pinger add-on checks for broken links. It is available on right mouse click after the installation. Unfortunately it is not compatible with Firefox Quantum. You can use Check My Links as a substitute. Sometimes it is slow.

Ditto is a great desktop tool for storing your copied data, you can configure how many entries it could save. Think of it as an advanced clipboard. With Ditto the standard Ctrl+C for copying, Ctrl+V for pasting combination gains more power. You should configure it wisely and handle passwords copying carefully so that no passwords are left for hackers in your Ditto database.

SEO testing

SEOquake provides multiple metrics and improvement recommendations.

Performance testing

YSlow is plugin for performance testing. Has nice suggestions for speed improving and several graphics.

You can also use the developer console for testing, here is article with example for performance testing.

Proxy testing extensions

FreeMyBrowser is a plugin for testing, that hides your IP. You have to give your email address to use it. Has several predefined countries locations like Germany.

GeoProxy has a huge list of proxies all around the world. No registration is required.

Accessibility testing

Funkify is a great Chrome extension for accessibility testing, currently in beta. It allows you to experience the web browsing in the shoes of a person with different disabilities.

Other great plugins

Javascript Errors Notifier is Chrome extension. It allows you to see JavaScript errors without the need to look into developer console.

Relative XPath Helper and XPath Helper are useful when you need to test your XPath expressions. For more ways to test XPath expressions, please visit this page.

RSS Feed Reader for Chrome allows you to easily see updates from Atom and RSS feeds.

JSON Formatter makes JSON data easier to read in your Chrome browser. If you prefer, you can use an online JSON code beautifier.

Summary

I presented you more than 20 useful browser plugins, used for visual, performance, content and SEO testing. Have I missed your favorite plugin? Yes? Sorry, I have written only about the plugins I use most often. Feel free to include it in comments, along with the reason why it is awesome.

Happy testing!

Software Testing Types Starting Points

Software Testing Types Starting Points

Which testing type will you start with?

In this article I will explain the most common testing types for web applications with simple words. I will not use ISTQB or other certification authority glossary. I will give tool examples and starting points for more information.

Security is a top priority.

If you are given entire application to test or you own small web app, start with security testing. This testing checks your application vulnerability. Could unauthorized user login or make changes without permissions?  Is your user’s data at risk? Can someone use your application for making profit for himself?

Why is this important?

Who wants to give credit card information to a hacked website?  Not me. Not you.

Imagine you have worked hard for years, have good SEO rank and loyal customers base. Then one day someone hacks your application (web site). You could easily lose your business overnight. Not something you want to experience, right?

Do not have illusions that you can catch complex security bugs. There are experts that specialize in that field for many years and even they cannot discover all issues. Even big companies discover vulnerabilities in their product and provide patches and updates.

Your job is to make your application less vulnerable. Enforce good password policy. If you own small WordPress site, install security plugin with firewall such as WordFence. If you work in a bigger company, involve related stakeholders (administrators, security experts). Good place to start is OWASP top ten list with vulnerabilities.  Test for the ten most common vulnerabilities and share your findings with the developers in your team.

What to focus on next?

Nobody wants to wait. Performance is essential.

Performance testing is ensuring that your application is fast enough for a wanted period of time with expected users number. Generally the faster, the better, 2 seconds is considered as the limit for responsiveness. Maximum two seconds after user has requested URL, he should see something valuable, or he will leave.

An easy way to check your current speed and areas for improvements is online on https://developers.google.com/speed/pagespeed/insights or web page test.

SEO testing

You have thought of security and performance. But if your site is not indexed properly by search engines, you will either not have customers, or will have to spend more on paid advertising and direct marketing.

Search engines like Google and Bing like great content, semantic markup and structured data. Your robots.txt and sitemap files should be carefully updated. I have heard a joke:

“What is the ultimate revenge of a fired SEO expert?”

The answer is :

“To put in robots.txt file only the two lines below.”

User-agent: *
Disallow: /

With these simple lines, you are telling that you do not want your site to be indexed. Not funny at all if this had happened to you.

Good starting points are Google Analytics and Google Search Console. From Google Analytics I extract information such as most popular pages and real users number and behavior.  I use Google Search Console for finding crawling errors and request indexing. In order to use them you should have account and you have to add applications that you could verify are yours.

Cross-browser and cross devices testing

Your application should look equally well on different browsers and mobile devices with different screen resolution. Quick way of doing responsive testing is to resize your browser window or use browser extension like Chrome Window Resizer.

I often use Chrome device mode before testing on real devices, because it saves me time. You can use this mode following the steps:

  1. Open Chrome browser.
  2. Press F12.
  3. Press Toggle Device Toolbar (Ctrl+Shift+M)

When you want to return to normal browser mode, you should press the same icon.

Functional testing

Ensure your web application functions as intended. For example, if you distribute products as downloadable files, ensure users can really download them. On my site, there is a search form. Functional testing will be to execute searches with different input strings and see whether expected results are returned.

As a starting point, you could assess your application functionalities, what are their priorities and risk. Write test cases or checklists that cover them.

Integration testing

This is testing how your application communicates with other applications. For example currently on this post I have enabled Disqus post comments instead of default WordPress comments. I should test that user can post and the post appears both in the blog post and in Disqus admin area for my site.

You should have a list of such integration points.

Regression testing

Ensuring that something that worked yesterday, is working today. Great way to execute this type of testing  is using automation tools, such as Selenium. You can do regression testing manually, but it is more error prone and time-consuming.

Summary

The article explained briefly the most common types of testing for web applications. It provided real live starting points for security, performance, SEO, cross-browser, integration and regression testing. In next articles I will go into more details on how to perform the tests, as well as I will give real bug examples.  See this article for the four most important things to consider, before you start testing.

Software Testing First Steps

Software Testing First Steps

So are you ready to start testing web applications?

What are the most important things to consider?

From my experience,  before you start testing anything, you should be well prepared.

1. Domain knowledge is essential.

For example if you have not tested for directory traversal vulnerability (security testing), make a research and prepare a checklist with your test cases. You will not be able to find a specific bug if you are not aware what to look for. If you don’t know what is capybara, how you will know where to look for it?

 2. Access the current state of the application (system under test – SUT).

I often make screenshots and test logs, because I find them very useful. If you miss this step and you find bugs, you will not be sure where they came from. Are they legacy bugs or are introduced recently by the developer of your current story? What would you do if your manager asks you: “Have you tested X and Y scenario?” If you have test log or checklist, you will be able to answer without hesitation.

3. Test data (data you test with) is extremely important.

I have seen my colleagues testing with strings that mean nothing at all, such as test test or asd asd. This step is even more important when you do integration testing. With simple words, integration testing is how your application interacts with other applications. If you test forms, usually you can add unique identifier for your submissions, such as the date, your name initials or the functionality you are testing, in one or all fields of the form. This identifier will help you to find your submissions and to validate your results.

4. Tools and extensions

Think for tools that can make your current quality assurance task easier and less error prone. Below you can find examples of two tools for test data generation. Example for online site for test data generation is http://www.generatedata.com/. I like that there are predefined test data fields, including names, cities, credit card numbers, and you can download the data easily as Excel file. You can find more easy to use online resources in this article.

I find often useful Chrome plugins for different testing tasks. For easier testing of forms, for test data generation I use bug magnet Chrome extension (available on right mouse click).

For more than 16 other great browser extensions, visit this article.

Summary

In this article I reviewed four most important things that you should think of, before you start testing. They are to acquire domain knowledge, to assess the application state before the tests, to prepare test data and tools for execution of the testing.

If you are still curious what is capybara, it is a cute animal, you can google it. Also there is a test framework named Capybara. It is OK to don’t know something, as long as you are able and willing to find information for filling the gaps. This is very important for a quality assurance expert.

Do You Want to Become a Software Quality Assurance Expert?

Do You Want to Become a Software Quality Assurance Expert?

Quality Control
If you are not sure whether to take the journey to becoming a quality assurance savvy, this post is just for you. First things first.

What is Quality Assurance?

There are many definitions, but for me it is:

Delivering a product or a service that is easy to use, easy to learn, and meets stakeholders needs, incl. legal compliance.

I truly believe in Agile Manifesto. I did not write “meets requirements” on purpose. Because requirements are something we put on paper or discuss in a conversation. They are not something we set in stone. Often the stakeholders cannot express their needs correctly. It is a part of your job  to discuss and clarify as well as you can. That is why QA expert needs good communication skills and analytical thinking. Also nice to have is the ability to understand complex requirements and find the pitfalls as early as possible.

There is a theory that to become an expert in something, for example to learn a language or to play a musical instrument, you should dedicate to it, on average, 10 000 hours. Truth is that there are no magical numbers, but hard-working would certainly help you in achieving your goals.

What else do you need?

Curiosity and passion for constant learning and development. Gaining domain knowledge is a must.

QA is like a good doctor. And equally important. If the issues (bugs) are found early, the consequences for the project and the reputation of the company will be not as serious as if found later.

You should also be able to deal with uncertainty, because exhaustive testing is not always possible. You often rely on risk assessment and prioritization for your testing efforts.

Do you think you lack something?

Maybe you are considering a career change, and you are not sure whether you can switch to QA?

If you are passionate and curious, every other skill can be acquired.

This blog can help you with the constant learning, keep reading!