How to view documents using Visual Studio

View documents in Visual Studio with an amazing tool

Xpath Axes

A very useful trick for automation

Review: Spire.DataExport for .NET

A great tool for exporting data in .NET

How to install Arch Linux, step by step, for VMware Workstation (Part I)

First part of a installation tutorial for this beloved OS

How to setup a local repository in Ubuntu

The steps to have a local repo in Ubuntu

Sunday, November 13, 2016

Microsoft exam 70-466 free material





The 70-466 exam is the hardest exam for many people because your skills in MDX and DAX are tested.

MDX is a very complex multidimensional query language. There are few experts on that language. DAX tries to be easier and it tries to be similar to Excel, but when the query is complex DAX can be very tricky.

Optimizing the performance is also a really hard task because it can be a problem in hardware, design or just the query. There are many aspects to verify to improve it.

The easiest section is Reporting Services. It is easy to learn and configure.

Another topic is Tabular Databases. Microsoft is now offering a new Database model alternative to the traditional multidimensional.  Tabular uses DAX, but the topic in general is not so hard to understand and learn.

There is no Microsoft Training Kit book for this exam and the MVA course is not enough to pass the exam.

However, there is a nice free exam to practice here:

http://www.boson.com/bee-webdemo/selectwebdemo.aspx?d=MIC-ES-70466-01

There is also a paid version of the simulator exam that includes 150 questions, answers including useful references for the exam:

http://www.boson.com/practice-exam/70-466-implementing-data-models-reports-microsoft-sql-server?r=1

You need to press add to cart to purchase the simulator exam.


Thursday, November 3, 2016

Performance testing with JMeter: My first Test Plan


A good performance is one of the main goals of any software projects. Taking that into account, chances are that you'll eventually end up doing some performance testing. For web pages, this is critical. If an online application have performance problems, this will have an important impact on the user experience.

So, in this article I'll show how to create a basic test case with JMeter, a performance testing tool by Apache.

Requirements:
Install Apache JMeter

1. Extract the .zip or .tgz file. I extracted mine to C:\jmeter.
JMeter path

2. Go to that path and you should see the apache-jmeter-3.0 folder.

Running your first test script

1. Open the JMeter path > bin.
2. Double click jmeter.bat. The JMeter UI will be displayed.
JMeter dashboard
3. Each test plan (which is a a series of steps JMeter will execute when run) can be saved as a .jmx file. So, for this first example, we can use one of the sample scripts that come with JMeter. So, go to File > Open.
4. Double click 'examples' and select CSVSample.jmx.
File selection
5. Click 'Open'. The file will be loaded in the left pane of the dashboard.
Loaded sample
6. Finally, to run this script, press Start.
Start script
7. You won't see much happening, but click 'View Results in Table' and you'll see the test results:
Results in table

Creating a test plan

Now we will create our own test plan. This will be a simple plan, just to show you how you can construct more complex Test Plans once you got familiarized with JMeter.

1. Click 'New'.

2. If you don't want to save the current items, click No.
3. Enter a name for the test plan. I'll call mine 'Testools Test Plan'


4. Right click Testools Test Plan > Add > Threads (users) > Thread Group.
5. Right click Thread Group > Add > Sampler > HTTP Request. This will add an element that will allow us to do a GET request to a page:

6. In 'Server Name or IP' enter www.testools.net. We will do a simple GET request to the Testools page in this step.
HTTP request configuration
7. Now we need to add a listener. This will catch the results and display them. Right click Thread Group > Add > Listener > View Results Tree.
8. Save the Test Plan. To do that, go to File > Save. Select a folder and enter a name for the file. In this case, I'll call it TestoolsTestFile.jmx, and I'll save it at C:\jmeterScripts. Then click Save.
Test Plan Script
9. Press Start.
10. The test won't take long. Notice that a new item was created in 'View Results Tree', in the left pane. Click it to see the details:
Results

And that's it! You can add more elements to the Thread Group to achieve your testing goals. In future articles I'll cover more of the functionality of JMeter, but this should be enough to get you started.

Tuesday, October 25, 2016

Tools for API REST testing


Sometimes we have to test some feature on the fly, especially if you are supporting more than one team on QA. I already showed how to test APIs with java and Apache libraries, but you my find yourself in a moment when you don't have your code at hand. Then, what to do?
Fortunately, there are some options for this. I´ll check a couple of them.

Postman

Postman is a Chrome and Mac add-in that allows us to work with all kind of API requests. This is a great option for QA, since it has a comprehensive set of options displayed through a nice UI. But let's play a little with a request:

1. Download Postman here.
2. Install it.
3. Open Postman. You should see something like this:

4. For this example, we'll use the pubic API from https://httpbin.org/. So, let's make some GET requests: Paste the following in the main text box: http://httpbin.org/gzip (Returns gzip-encoded data). Make sure that the request is a GET, and then press Send. The result should be displayed in JSON format, like this:


Postman is a comprehensive tool with many options. However, these are the features I liked the most:

History: This is especially useful when you do a lot of requests with different URLs. Sometimes it's hard to keep track of the URLs and configurations, but you can check any past request if you need to in the History:
Request history

Multiple tabs: You can open new tabs, each one with the particular set of options you set. This is useful when you need to copy or compare parameters from different requests, like copying an authentication token.
Multiple tabs

Postman is a great tool, with many advanced options that can help both developers and QAs. However, what if you can't install Postman for some reason? Some organizations have the access to the Chrome store blocked, and contacting IT just for a quick fix might not be always the answer.

Online REST test

There are many pages to do simple requests. These do not have many options or advanced configuration, but they might be helpful to some tests on the run. Examples:

REST test test

You can find this tool at https://resttesttest.com/. To make requests with this tool:

1. Open the page.
2. Select the method. In this case, it's GET.
3. Select the endpoint. We will use the URL we used before (http://httpbin.org/gzip).
4. Press Ajax request.
5. You should see the same response than the one you obtained with Postman.

These tools are not uncommon in internet. For example, you can also use this: https://www.hurl.it/, which will give you most of common options for these tools (Add authentication, header, parameters, etc.):


Monday, October 24, 2016

CSS selectors for automation: how to use them


One of the most common problems we face when automating is that the elements' locators become obsolete as soon as there is a change in the UI we are testing, and most of the time the options for this are clear: Xpath or  CSS Selectors. I´m not comparing them in this article, since there's some controversy around the question. I found an interesting article that compared Xpath and CSS Selectors in terms of performance and other metrics, you might want to check it out. So, there are many reasons to use CSS Selectors. Now, I´ll show some basic tricks with CSS Selectors with a framework with Java and Selenium in mind.

Content

Select by ID
Select by tag
Select by class
Select nth element

Requirements
Prerequisites:

  1. First of all, open Firefox. We will use this page (www.testools.net) for the examples, so open it in a new tab. 
  2. Now, right click on the Testools logo > Inspect Element with Firebug.Inspect logo
  3. Click FirePath.
  4. Click the button at the left of the text box and select CSS. Here we will test our CSS Selectors.CSS text box

Select by ID

First, let's check the HTML structure for the logo:
Logo ID
As you can see, the id for the Logo is Header1_headerimg. In CSS Selectors, IDs are selected using #. So, in this case, we can select the logo with this:

#Header1_headerimg

Open the FirePath tab and paste that string, then press Enter. You should see a match:
Selected logo element

Since IDs should be unique, using them is a safe way to select elements for Selenium. However, not all elements have a unique ID, and asking developers to add them is not always an option.

Select by tag

You can select elements by tag, although this is better used in along with classes. However, tags are selected only with the tag name itself. If you'd want to select all the elements with the tag img, like this:
img tag

You'd only need to write this:

img

And it will match all the elemts with the img tag:
Selection by tag

Select by class

Classes are selected using dots. For example, if we want to select the first post:
Posts inspection
We can do it by typing the class name preceded by a dot:

.wrapfullpost

This will select all the elements with the class wrapfullpost. In this case, 5 elements are selected, since there are 5 posts in the main page:
Select by class

Select nth element

In the example above we had 5 elements selected. But what if we want to select only one of those elements? Let's check another example. Enter the following css:

.menus.menu-secondary.sf-js-enabled.sub-menu

That will select the menu:

Menu selected

If we expand the selected element, we will see that the four menu elements are represented by 'li' nodes. To select the 3rd element, we can use:

.menus.menu-secondary.sf-js-enabled.sub-menu li:nth-of-type(3)

3rd element

Note that, to select the first element you should use nth-of-type(1). Unlike most of other syntax, here you start the count in 1.

This will be enough to get you started using css selectors!

Tuesday, October 4, 2016

API testing: Get requests with Java and Apache libraries


API testing is very common nowadays, and it's easy to see why. One of the uses of APIs is to manipulate an application to create pre steps (among a lot of other things) for scenarios without the need of handling the UI, which is good news for all who struggle with locators that change a lot.

In this article I will show how to use Java to perform basic API actions with the Apache HttpComponents. Let's check it out:

Requirements:
Steps:

1. Open Eclipse and create a new Java Project. Call it 'APITesting'
Project details

2. Right click src > New > Class. Name the new class 'APITesting'. Select 'public static void main(String[] args)' to create the main method snippet. Then click Finish.

Class details

Class created

3. Add the needed libraries. For this, expand the APITesting project and right click JRE System Library > Build Path > Configure Build Path...
4. Click 'Add External JARs'
5. Navigate to httpcomponents-client-4.5.2\lib and select the following libraries:
  • httpClient-4.5.2.jar
  • httpcore-4.4.4.jar
  • commons-logging-1.2.jar
Then press OK.
6. Now that you have all the required libraries, enter the following code into the APITesting.java class. The final result should look like this:


So, basically, you have to perform 3 main actions here:

- Create a httpClient:

HttpClient httpClient = HttpClientBuilder.create().build();

- Create a GET request with proper endpoint and add the header:

HttpGet getRequest = new HttpGet(
"https://jsonplaceholder.typicode.com/posts");
getRequest.addHeader("accept", "application/json");

- Execute the request and store the result in a HttpResponse:

HttpResponse response = httpClient.execute(getRequest);

From there on, you can play with the contents of the response and print it, as I did in this example. Click the Play button in Eclipse to run the code. You should see a json text as response in the console:

Response