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

Friday, December 19, 2014

Send secret messages with Qlink.it

Some time ago I wrote a short anonymity guide in Internet. I didn't know Qlink.it back then, but I would have included in that article. It's such a simple idea that when you hear about it, you think "why I didn't thought about it before??".

The service, as I said, is very simple. You can use it following these steps:

1. Go to Qlink.it.
Qlink main page

2. Write a secret message (you can also attach a file and include your IP, although I don't think that's a good idea).
3. Click 'qlink it!'
4. A link will be generated, and now you can send it through email or other mediums.
Qlink generated
5. The link can be accessed only once. It expires after that (for example, try this link. It's broken)
Expired message
As you can see, it can't get much simpler than this. This is one of those moments when you realize that you had this necessity, but you couldn't formulate it coherently. Well, these guys could.

I think this is great news, but take into account that this service is still in the Beta phase. However, I like it because it does not rely on passwords. It's not like sending a .zip file with a password, since someone could get a copy of it and ultimately unencryp it. Here, you know that nobody saw the link until you click it. Apart of that, there are no traces of where the link was created.

Maybe the only part I don't like is the name. It's clear that the creators of the app wanted to give it a name that follows all the rules of marketing, but the '.it' does not deliver a clear message. When I think about it, it's just 'Qlink', without the '.it'. But that's just a detail.

I recommend to check the details of the service here. I think this has a future. Next time I'll review the Android app that they already have in Google Play.

Thursday, December 18, 2014

Java + Selenium + Maven + TestNG + ReportNG integration

Java and Selenium work great together. They are a popular combo when it comes to Automation Testing. In this article I'll show you how to integrate Java, Selenium and also Maven, TestNG and ReportNG. This set of tools provide enough flexibility to create a tailored automation framework for almost any automation project. It is not so difficult, but it can take some time. This is what I'll use in this example:
  • Ubuntu 14.04 (get it here)
  • Eclipse Luna (get it here)
Requisites:
  • Maven installed
  • Eclipse integrated with Maven and TestNG (I recommend to read this article before if you need further details)
In this case, I'll work with the default driver provided by Selenium. That means that the tests will only run with Firefox.

Steps:

Create a basic Maven project

1. Open Eclipse
2. Click File>New>Project...
New Project menu
3. Select Maven>Maven Project, then click Next
Maven project
4. Click Next twice
5. Enter the Group ID and the Artifact ID (if you don't know what are they about, please check this). You can use the following configuration. Then click Finish.
Maven Project configuration

Add required dependencies

The heart of a Maven project is the pom.xml file. Here you can specify important aspects of the project, and also you can add dependencies. This is like adding .jar libraries, but Maven handles everything and in most cases, it is possible to find the dependency in the Maven online repository.

1. In the Package explorer, double click the file pom.xml
POM location
2. In the main panel, click "pom.xml":
POM edition
3. Now, add the following code to the pom.xml file:

<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>6.1.1</version>
  <scope>test</scope>
</dependency>

The file should look like this:
TestNG dependency
4. Add the following code to the pom.xml file:

<dependency>
  <groupId>org.uncommons</groupId>
  <artifactId>reportng</artifactId>
  <version>1.1.4</version>
</dependency>

The file should look like this:
ReportNG dependency
5. Finally, add the following code to the pom.xml file:

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>2.44.0</version>
</dependency> 

6. Now you need to add the Surefire plugin to use ReportNG to get better reports and also to specify an .xml file where the test cases will be listed. So, add the following lines to the pom.xml file:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                </properties>
                <suiteXmlFiles>                    <suiteXmlFile>src/test/java/net/testools/resources/testSuite.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
    </plugins>
</build>

Place that just outside <project></project>.

Run a basic test case

1. Create a simple test case. I created one that just opens the browser and closes it. This is the code:

package net.testools.test_project;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

public class TestoolsTest {
public TestoolsTest() {
}
WebDriver driver = new FirefoxDriver();

@BeforeMethod
public void setUp() {
driver.get("http://www.testools.net");
}

@Test
public void simpleTest() {
Assert.assertTrue(driver.findElement(By.id("Header1_headerimg")).isDisplayed());
}

@AfterMethod
public void tearDown() {
driver.close();
}
}

And this is the folder structure I'm using:
Folder structure
2. Create the .xml file to run the test cases. If you see closely at the picture above, there's a file named testSuite.xml. Create it at the same folder level with the following code:

<?xml version="1.0" encoding="UTF-8"?>
<suite name="TestSuite">
  <listeners>
    <listener class-name="org.uncommons.reportng.HTMLReporter" />
    <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
  </listeners>
  <test name="Test1">
    <classes>
      <class name="net.testools.test_project.TestoolsTest" />
    </classes>
  </test>
</suite>

And, finally, that's all. Now, to try your configuration, open a terminal and go to the root of your project (where the pom.xml file is). Now, run this command: mvn clean install. If everything went well, you should see something like this in the terminal after the test ran:
Tests run
And here's a screenshot of the report enhanced with ReportNG. This is generated by default at: /test-project/target/surefire-reports:
ReportNG report

I know that there's plenty of space for mistakes with this, so you probably won't get it working the first time, but it's actually easy once you understand how Maven and the tools work. Good luck!

Saturday, December 13, 2014

Integrating Maven and TestNG with Eclipse

OK, this a pretty simple article, but I decided to publish this first as a requisite to integrate Java + Selenium + Maven + testNG + ReportNG. I don't want that to be a extremely long text, so this short article will help to reduce it. Just in case, I'm using a Ubuntu 14.04 machine, but the instructions are valid for Windows as well, as long as they are not commands in the terminal. Let's get started!

Requisites:

  • Eclipse (the latest version, download it here. I used Eclipse Luna, which includes Maven support)
  • Maven installed (instructions below)

Steps:

Installing Maven

1. Open a terminal
2. Enter the following classic command:

sudo apt-get install maven

3. Once the required files are downloaded and installed, type this in the console: mvn
If you see something like this:
Congratulations! Now you have Maven installed on your computer. However, you'll see an error message like this:

That means that you don't have your JAVA_HOME environment variable set. To do that in Ubuntu 14.04, open a terminal and enter the following command:

sudo gedit ~/.bashrc

Note: Gedit is a text editor, very useful. If you don't have it yet, install it with: sudo apt-get install gedit

A text editor will be opened. Go to the bottom of the text and enter the following lines:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre
export PATH=$PATH:/usr/lib/jvm/java-7-openjdk-amd64/jre

Of course, you need to set the path where you have Java installed. Now, save the file and type this in the console:

source ~/.bashrc

Try the command mvn again. It should be working now.

Installing Eclipse and testNG

1. Once you download the compressed Eclipse file, just extract it somewhere. Once you do that, double click the "eclipse" icon:
Eclipse will open.
2. Go to Help > Eclipse Marketplace...
3. In the 'Find' field enter testng and click 'Go'.
4. Click 'Install' in 'TestNG for Eclipse'
5. Click 'Confirm'
6. Select 'I accept the terms of the licence agreement' and click 'Finish'
7. Click 'OK' in the Security Warning dialog.

8. Restart Eclipse and that's it, you now have testNG integrated with Eclipse.

With that, you'll be ready for the next article.

Monday, December 8, 2014

Tip: How to solve the problem "VMware Workstation cannot create ~/.vmware directory"

vmWare Ubuntu
When I installed VMware Workstation 10 in my Ubuntu 14.04 (you can check some old instructions here, they still work) I had a problem. Whenever I started VMware, I noticed that the machines I had and all the preferences were gone, and a message warned me: VMware Workstation cannot create ~/.vmware directory. That's the directory where VMware stores all data related to preferences. For example, if you hide the toolbar, next time you'll see that it is displayed again, since VMware couldn't save those settings.

The solution for this is very simple. Just run this in a terminal:

sudo chown -R username:username ~/.vmware

For example:

sudo chown -R john:john ~/.vmware

This problem is caused because the ~/.vmware folder is owned by the root user. If you just follow the default instructions to install VMware you'll stumble upon this problem. The command just changes the ownership to your user, and that's it. I hope this little tip is useful!

Monday, November 24, 2014

Google Contributor: The web without ads

Contributor by Google

We all know that most of the Internet is funded on ads. And I personally think this is OK: creating content and managing all the details of a site takes time and sometimes cash. Like radio or TV shows, creators of content need to find funding through ads. This is even more important for a solid industry in Internet. Just imagine this: there would be no social networks, Google, or any other free service if there weren't ads. But some people don't like ads. I'm not one of them, but some find ads so annoying that they would pay to get rid of them. This is already true for some mobile apps, mostly for Android. But what if you were willing to pay to get rid of ads in a regular website? Apparently, this is the question that they asked in Google, and the answer is Google Contributor, an experiment to eliminate ads in the sites you visit.
Basics Contributor

The idea is simple: you choose a contribution to be paid monthly to the participating sites and you'll see no ads there. Instead, there will be a "Thank you" message where the ads were before.
No ads Contributor

Ok, I don't see any ads and the content creator just said "Thank you". Is that all? Am I paying just for that? In short, no. The most important benefit for the user is something that everybody is losing online: privacy. Without ads, no one needs to track your preferences or your activity just to show you the right commercial offers. I'm pretty sure there are some people that totally would pay for that. Also, there's some controversy about advertisement as a source of revenue. For example, take into account this SWOT analysis for Facebook. Advertising as a source of revenue is taken as a weakness.

For now, Contributor is only an experiment, and you need to join a wait list to get and invitation and try it. However, this could be a new market for funding the web that's unexplored yet.

For more information, visit the official page of Google Contributor.

Tuesday, November 18, 2014

How to create SQL Server Backups from my Smart Phone

This time we will present a very cool tool.

Simple, fast and easy to learn, versatile. The tool is Sql Bak. You can download the software from this site:
https://sqlbak.com/

The functionality can be summarized in this picture:



You can control and send jobs to backup or restore your SQL Server Database from any device like:
  • A Laptop
  • An iPhone
  • A Windows Phone
  • An Android Device
  • A Linux/UNIX machine
Requirements:

You need to install the SqlBak in the Server with SQL Server Installed. The SqlBak program will allow you to control your application from any device!



Once installed, you have to connect to the SqlBak site and connect with any of these accounts:
  • Twitter
  • Google
  • Facebook


Once logged, you can monitor the machines with the SqlBak installed.


I tried to access from my Samsung Galaxy without any problem. To create a new job. Press the Add new job button.


You can configure it to store the backups in the Clouds (Amazon S3, Dropbox, Google Drive, One drive, etc). In this example I tested Google Drive. Press the Run Now to run the Backup.


The log of the job will show you all the information related to the backup process and any problem that occurred. 


Here you can see some information in the Android device about the backup steps. You also have additional buttons to restore the backup or to download the file.

In this example, I tried it with Google Drive. Open Google Drive.


The file name is ReportServer201411161914.bak. As you can see, the file Repot...4.bak is now in Google Drive.

The SqlBak is a very powerful tool. It is a practical simple tool with a vision to the future. It is fully integrated with the new devices, the cloud and the social networks. It doesn't get any better than this!

Monday, November 17, 2014

How to hover the mouse on an element with Selenium

I use Selenium a lot for testing automation. It's a good tool, and it's completely free, and that's a plus in some projects with limited budget.

So, with that in mind, I'll show you how to hover the mouse on an element using Selenium and Java. I know it's something basic, but I think that I'll save you some time with these tricks. 

For Firefox:

Firefox has an excellent integration with Selenium. You can practically control every aspect of the browser directly from the code. The following code does the work. 



This could be an easy solution for everything, but unfortunately there's a bug for Safari. This is important because most of the times the automated test cases have to run against every important browser. The solution is to use JavaScript and call it from the Java code. In fact, you can use this technique to solve several problems, as long as you know how to use JavaScript. So, here's a workaround for the problem:



However, I noticed that this code does not work all the time. You'll have to find another JavaScript code to use, but that can take some time if you are not an expert on that language. Something that worked for me several times was to simply click on the element, or on the parent element. Usually, the simplest approach is the best.

Sunday, November 16, 2014

How to save automatically your SQL Server Backups in OneDrive, Google Drive

The clouds. All the time I hear about the clouds. Today with the smartphones, the storage capacity of the smartphones is not as big as the PCs and Laptops and now, the file storage in Dropbox, One Drive, Azure, Amazon S3, One Drive, Google Drive and etc. is more popular each day. 

People need to access to their data everywhere and the Cloud is the solution.

In this new article we will show a nice tool name SQL Server Backup and FTP. This is an amazing tool to automatically zip and backup our Databases in Dropbox, FTP Servers, Network drives, Amazon S3, Azure, Google Drive, One Drive, Box.

This article shows:
  1. How to send the SQL Server backup to One Drive.
  2. How to receive emails after the backups using SQL Server Backup and FTP.
  3. How to send the SQL Server backups to Google Drive.
1. How to send the SQL Server backup to OneDrive.

OneDrive  is a pretty nice free option to store your information on the Cloud. You only need a Microsoft Account. To Store your SQL Server

In SQL Backup and FTP, select the Add backup Destination Link.


Select the OneDrive option

Press the Authorize Button

 Sign in to the One Drive using your Microsoft Account (I am assuming that you already have an account in Google Drive).

You will connect to internet and the application will ask the permissions to access to OneDrive. Press Yes to accept the permission to the SQL Backup

The program will provide you a code that you have to copy and paste in SQL Backup and FTP.
Copy the authorization Code in the Authorization Code Window.


If everything is OK, now you will have OneDrive as a destination.
Press the Run Now Button to test.




If everything is OK, you will be able to visualize the backup in OneDrive.


2. How to receive emails after the backups using SQL Server Backup and FTP.

First specify the emails and then press the button to configure the emaisl.


There are 3 options.
You can use the Automatic which I strongly recommend because you do not need to configure something else. The Gmail option requires to Change your gmail security setting, which is not recommendable.


I received the following email from gmail:

Hi Daniel,

We recently blocked a sign-in attempt to your Google Account [calbimonte.daniel@gmail.com].

Sign-in attempt details
Date & Time: Friday, 14 November 2014 23:15:56 o'clock UTC
Location: Cochabamba, Bolivia

If this wasn't you
Please review your Account Activity page at https://security.google.com/settings/security/activityto see if anything looks suspicious. Whoever tried to sign in to your account knows your password; we recommend that you change it right away.

If this was you
You can switch to an app made by Google such as Gmail to access your account (recommended) or change your settings at https://www.google.com/settings/security/lesssecureapps so that your account is no longer protected by modern security standards.

To learn more, see https://support.google.com/accounts/answer/6010255.

Yours sincerely,
The Google Accounts team

You can also try the custom option, where you can specify the SMTP information.

In this article we will use the automatic option. If you press the Run now button to get the backup, you will receive an email similar to this one:


3. How to send the SQL Server backups to Google Drive.

You can also store your information in the Google Drive. You will require a Google Account for it.
In SQL Backup and FTP, select the Add backup Destination Link.


Press the Authorize button to get authorization from Google to store your information on the Google Drive.


You will be prompted a permission message on the Web Accept the permission and copy the Authorization code and paste on SQL Backup and FTP

                                      

Specify the folder where you want to store the file. It does not need to be an existing folder.



If you login to Google Drive, you will be able to see a sqlftpbackup folder with the backup file zipped.

As you can see, it is very easy to store our backups using SQL Backup and FTP.

I strongly recommend this product to you.