Posts

Showing posts from January, 2017

Oracle: Determine the size of a table

The below post is of the type "problem-solution", where I first detail the problem encountered and then explain how I solved it. Problem: Determine the size of a table in Oracle. Solution: select segment_name,segment_type,bytes/1024/1024 MB from dba_segments where segment_type='TABLE' and segment_name='table_name';

Test if the database is up an running

The below statement allows you to quickly test if a database is available. To test if the DB is up an running use SELECT 1 FROM DUAL; That must return 1 is the DB is available.

Insufficient memory error when using xcopy.

The below post is of the type "problem-solution", where I first detail the problem encountered and then explain how I solved it. Problem: Insufficient memory error when using xcopy. Solution: Use less than 254 characters in the path (including filename) since: "Xcopy fails with an 'insufficient memory' error when the path plus filename is longer than 254 characters." http://en.wikipedia.org/wiki/XCOPY.

Selenium: User actions in the IE browser get triggered with a significant delay.

Problem: User actions in the IE browser get triggered with a significant delay. Solution: The issue seems to be related to resource saturation of the test machine: it usually comes up when ~20 concurrent browsers are used on the same machine and is not so obvious with 10 concurrent browsers. The order in which IE is started does not seem to matter. May be we need one node/server per IE?

Unable to bind to locking port within X ms exception when starting a Firefox browser

Problem: Unable to bind to locking port <port number> within X ms exception when starting a Firefox browser in Selenium. Solution: Use block synchronisation in the method that starts a browser, so that there is no race condition for browser creation.

Selenium: StaleElementReferenceException

Problem: StaleElementReferenceException. For example, when using: ((JavascriptExecutor)browser).executeScript("arguments[0].click();", this);  Solution: This exception seems to appear when performing actions on the same element multiple times and the element gets updated/reloaded between the actions. This approach seemed to work (the idea is to catch the StaleElementReferenceException and make the element not stale but current by finding it again): ...         int counter = 0;         while (counter < maxClickAttempts) {             try {                  this.originalElement.click();                 Utils.waitForPageLoaded(browser);                 // exit the while-loop if there are no exceptions                 break;  ...

Selenium: missing POST request

Problem: On Chrome 39 and IE 11 one of two POST requests was not triggered by Selenium, which caused functional issues. Solution: Investigation showed that the missing POST request was triggered by the window.onbeforeunload function from the application's JavaScript library. The function was not called due to what seemed to be a popup-related Selenium issue. The fix was to add the below line to the code: ((JavascriptExecutor)driver).executeScript( "window.onbeforeunload();" );

Selenium - increase JVM memory.

To increase memory available to selenium server to 1GB use this to start the server: >java -Xms1024m -Xmx1024m -jar selenium-server-standalone-2.31.0.jar ....

Selenium Grid 2 Basics: start, stop, monitor...

Note: below are Windows instructions using command line. To view the Selenium server .jar command line help use this:  >java -jar selenium-server-standalone-2.31.0.jar -role hub -h  OR  >java -jar selenium-server-standalone-2.31.0.jar -role node -h To start the hub:   >java -jar selenium-server-standalone-2.31.0.jar -role hub To start the node with the default configuration: >java -jar selenium-server-standalone-2.31.0.jar -role node -hub http://localhost:4444/grid/register -port 5555 View the node: http://localhost:5555/wd/hub/static/resource/hub.html - can be viewed without the hub running. View grid info:  http://localhost:4444/wd or http://localhost:4444/selenium-server View how many nodes were started:  http://localhost:4444/grid/console Shutdown the hub: http://localhost:4444/lifecycle-manager?action=shutdown ! Note that the node is NOT shut down at this point -> http://localhost:5555/wd/hub/static/resource/hub.html is stil...

Java: "instanceof" does not work if the first parameter (object) is of type Class.

Problem:  instanceof does not work if the first parameter (object) is of type Class. Solution: Use the equivalent of "object instanceof Class", which is isAssignableFrom. For example, MyClass.class.isAssignableFrom(testClass) returns true if MyClass is a superclass or the same as the class of testClass.

Other

This Study Reveals The 5 Biggest Regrets People Have Before They Die

Java - hello world - using JDK only.

The below outlines steps to create and execute a Hello World Java program on a Windows system using just a JDK. No IDE required, you can create and edit using Notepad or any other text editor. 1. Create a text file (main1.java) with these exact contents: class MyApp {     public static void main(String[] args) {         System.out.println("Hello World!"); // Prints the string to the console.     } } 2. Save it and compile it to MyApp.class in the command line (open cmd.exe in the same folder where your main1.java is located): >"C:\Program Files (x86)\Java\jdk1.6.0_26\bin\javac.exe" main1.java 3. The above step created the bytecode file: MyApp.class 4. Run it: >java -cp . MyApp Output: Hello World!

Why do we need real browsers in performance testing?

Here is some Pros and Cons for using real (as opposed to protocol simulators) browsers in performance/load testing. Pros: You get the benefits of both functional and performance testing. Real browsers provide the same behaviour as you would expect from a browser in production, which is not always true with emulated browsers (for example, different memory footprint usage of systems resources). Only real browsers simulate multiple concurrent connections going out (PPR, AJAX, ...) and correctly mimic the number of consumed ephemeral ports. In addition to that, it is not uncommon to find defects at the GUI level that (a) only appear with real browsers (some JavaScript bugs) and (2) only appear under the load (for example, some activation/passivation-related errors). You still have the flexibility of using headless (no user interface) browsers like PhantomJS or Chrome in a headless mode. Real browsers are also regularly updated as opposed to protocol simulators, which are usually m...

Risk-based performance testing - a working approach.

When working on a performance testing project I would strongly advise to address the higher risk scenarios first and to be aware of what the performance scope is covering in terms of the % of application's functionality/load. I know the latter is a tough one to figure out but it will pay off in terms of knowing of what is the business value of your testing. Below is the risk-based approach that I consistently used and it worked well for me: First get all known functional/business use cases for a given application/system as a basis for your performance test cases.  This gives you a solid base when later on you will need to figure out how much of the total functionality/load your tests covered. Then rank those in terms of their importance.  Importance could be defined as a function of indicators like criticality to business, load, number of screens involved, etc. Select the most important test cases and start your testing using those. The actual...