Skip to main content

Posts

Showing posts from March, 2012

Useful Linux Commands - III

Here are some useful linux commands... whoami - This command gives you the userid you are logged in as pwd - print working directory. When you type in this command it tells you which folder you are in and along with printing the path of the folder ls - listing. This command will list out all the files and directories under the current directory sorted alphabetically ls -F - This command lists all the files and directories with directories displayed with a trailing slash and executables have a * at the end of the executable name ls -s - lists file sizes - displays in disk blocks ls -s -h lists file sizes with human readable file sizes wc - word count displays lines, words, characters for a particular file wc -c  wc -w wc -l cat - concatenate - prints the file contents one after another sort - sorts the output  head - - gets the topN results from a file mv - move - moves a file cp - copy - copies a file rm - removes a file rmdir - removes a directory cd - change dire

Useful Windows Commands

ipconfig : Used to see the IP address and the gateway mask. Can also be used to ipconfig /all : Displays all the available information for a system ipconfig /displaydns : This will display the local dns file ipconfig /flushdns : This command will clear the local dns file systeminfo : Get the operating system information using this command systeminfo /S <systemname> /U <username> : Get the operating system information for a remote system using this command tasklist : Does the same thing that starting a task manager would do…Display a list of tasks running on the system. taskkill /im <imagename> : Kills the process with the image name provided taskkill /pid <processid> : Kills the process with the process id provided type : read a file from command line using type… netstat : You can get to know who/what is getting connected to your system   netstat –a: displays all connection info netstat –b : displays the executable name in the netstat output n

Interface for and just for Static Constants?

http://stackoverflow.com/questions/320588/interfaces-with-static-fields-in-java-for-sharing-constants   Looks like using an interface and making core classes implementing the interface which has just the static constants pollutes the core class export API’s. You might want to reconsider the choice of using Interfaces for Static Constants

AJAX Testing–Some Useful Links

Testing dynamic elements is always a challenge. I found some interesting/useful links which might prove useful to you too: http://agilesoftwaretesting.com/selenium-wait-for-ajax-the-right-way/ http://stackoverflow.com/questions/6850994/wait-for-javascript-file-to-load-in-selenium-2 http://saucelabs.com/blog/index.php/2011/04/how-to-lose-races-and-win-at-selenium/   Happy Testing!!!!

Apache Commons StringUtils.isEmpty() vs Java String.isEmpty()

You might want to test for if a String is empty many a times. Before we jump onto the numerous solutions available let us take a look at how we define “Empty String”   The difference in the two methods given by Apache and Java are dependent on how we define an empty string. Java String.isEmpty returns a boolean true if the string’s length is zero. If the string has null it throws NullPointerException Apache StringUtils.isEmpty returns a boolean true if the string is either null or has length is zero   Thus its purely dependent on how you are defining “empty string” in your program which will decide which function to use…BTW if you want to skip using Apache Commons funciton and would want to stick to java then you can have your own function like this:   public static boolean isEmptyOrNull(String strStringToTest) {                  return strStringToTest == null || strStringToTest.trim().isEmpty(); }

verifyTrue vs verifyEquals to compare strings

There is a clear winner here! Lets explore which one is better. Here is the scenario: “Lets say I have to test if the appropriate tooltip is flashed for a component” To get to the code directly, lets say I already have the tooltip text stored in a variable. Now all I have to do is to compare this string to the components tooltip text which I would get at runtime. So the algorithm would be Have the Expected Tooltip text stored in a variable Get the Actual Tooltip text for the component Compare the two strings – you should get the exact text We usually tend to use verifyTrue to compare because according to our algorithm we are expecting the result of the string comparison to be TRUE There is nothing wrong in using verifyTrue as if your test passes there is no difference in using verifyTrue or verifyEquals. The actual difference comes into picture only when your test fails. String varExpectedTooltipText = “Some tooltip”; // Method 1 - verifyTrue(selenium.getAttribute(&qu