BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
In the first part of this series, we introduced servers, domain names, UNIX, C and virtualization. Those are the building blocks on which modern applications are built. This article will cover network traffic -- a code that is carried to a web browser and translated as a webpage, which will take you a step closer to becoming a technical tester.
Learn how to use curl
Most testers are familiar with URLs -- the Uniform Resource Locators -- that we type into a web browser to bring up a webpage. Google.com is a famous URL. Curl is a command-line program to download that webpage as text and send the results to a screen. It is included in Unix, Linux and Mac OS X, and is also available on Windows for free.
It's simple to store a list of URLs in a file along with expected results. In most cases, expected results won't be entire HTML pages. They will be snippets like "no results found" for a certain complex search when the search algorithm is known to return extra results. Or perhaps "1-10 of 10 results found," when using a static database that should never change.
The real power of curl is not to bring down entire webpages, but to hit a specific API. For example, the British National Center for Text Mining has a public API that returns abbreviation lists in JSON format. Here's a sample URL:
Run that through curl to get a list of terms that are abbreviated as MRH. Change the letters MRH to anything else (such as ABC) and re-run curl to see the changed values. One classic use of curl is to store a variety of test cases in a file with expected results, then loop through them.
Curl also supports basic http authentication, cookies and other methods. Now that you're a more technical tester, you can use it on a website where a login is required. A programmer's help might be required when working on how to get a cookie or to find out how a cookie is changing over time.
An inside look at TCP/IP
A URL pulls down content such as JSON, HTML, CSS or some other sort of file. That file is transferred, likely through the Transmission Control Protocol (TCP), over the Internet Protocol (IP). TCP/IP breaks a file into packets, sends one at a time and waits for an acknowledgement called an "ack." If that ack is not read, TCP will send another packet. This is different than the User Datagram Protocol; UDP does not check to see if all the packets are returned. That is helpful in environments where old and lost packets do not have a value, like streaming live video.
Most networks today run an Ethernet protocol -- a single router manages all the traffic between computers. Each computer gets all the traffic on their network, but will have a unique address.
Wireshark is a free application you can use to view, log and inspect the packets that come through a network. The number of packets will probably be initially overwhelming. While performing test work, you would probably want to limit the capture only to your internal network IP address and port 80. Double click and scroll down on that line to get details. Wireshark can even read encrypted (Secure Sockets Layer) traffic if you can get access to the appropriate keys and do a little work.
Most people want to view and manipulate just the packets going back and forth from their browser, including secure traffic. Ideally, this should be done without fiddling with the public and private keys.
The easiest way to avoid that is to use the tool embedded in a browser. Most browsers call these "developer tools."
Browser developer tools for a technical tester
To walk through the developer tools, create this simple HTML page as a file, which has a single button that directs a browser to techtarget.com:
Use a browser to reach the file to see it on a screen and click the button, but nothing happens. If you read the file, you can see that the 'D' in the call to myRedirect is accidentally capitalized, but the viewer does not know what went wrong.
Reloading the page, go to the developer tools, then click the button and see something like this:
Another helpful developer tool is the network tab that will show all the files that were downloaded. Clicking on the details will show contents of that file. To learn the network tab, first go to maps.google.com, bring up the tab, then click and drag to load new areas of the map. See the files as they load along with status codes (200 is OK, 500 error, 404 file not found). Click on the file name to preview a file or see http headers.
Moving forward as a technical tester
We have covered the text below a user interface, which an engine like Safari, Chrome or Internet Explorer will use to create webpages. The tutorial included the terms, tools and even a few exercises to explore the possibilities with those tools. Armed with this information, you can go deeper into your own company webpages to find out if the problem is a text of a page or the API.
Future articles in this "more technical tester" series will cover HTML and CSS, the programming language of the browser, along with finally writing code to automate routine testing tasks.
Why automating software testing is beneficial
Learn what's new in Internet Explorer
Possibilities with Windows 10 command-line console