Filed under Apache JMeter, Test Automation.

Here are details on how to save or export the results of your Apache JMeter test script to a CSV or XML file.

Setup

1. Open Apache JMeter (here is how to start Apache JMeter on Mac) and right click Test Plan and Add -> Threads (Users) -> Thread Group
2. Right click Thread Group and Add -> Samplers -> HTTP Request
3. Add example.com to the Server input field of the HTTP Request
4. Right click Thread Group and Add -> Listeners -> Aggregate Report

More details on how to load test a web server with Apache JMeter.

Save Apache JMeter Results to a CSV file

1. Configure the filename in the Filename field of the Aggregate Report
i.e.: [FULLPATH]/results.csv
where [FULLPATH] is the path on the disk to the directory where you want to save the Apache JMeter results.
2. Run the test script
Result
A file with the results.csv name should now be created at the path specified.

Save Apache JMeter Results to a XML file

1. Go in the Aggregate Report and click the Configure button
2. Check the Save as XML field in the top left corner.
3. Change the extension of the filename to XML i.e. [FULLPATH]/results.xml

Result
A file with the results.xml name should now be created at the path specified.

 

Save results to current test script location

If you want to use the current test script location as the destination of your Apache JMeter test scripts, you can follow the below steps:

1. Right click the Thread Group and Add -> Config Element -> User Defined Variables
2. Add a new variable called resultsfile and for the value use the following:

For CSV: ${__property(user.dir)}${__BeanShell(File.separator,)}result.csv
For XML: ${__property(user.dir)}${__BeanShell(File.separator,)}result.xml

(make sure the Save to XML is checkbox checked in the Aggregate Report)

3. Go to the Aggregate Report and add the ${resultsfile} in the Filename field.

Result
A file with the results.csv or results.xml name should now be created at the path specified.

 

Dynamic Filenames

In order not to overwrite the result values from the JMeter script, we can append a timestamp to the filename:


For CSV: ${__property(user.dir)}${__BeanShell(File.separator,)}result_${__time(yyyyMMdd-HHmmss)}.csv
For XML: ${__property(user.dir)}${__BeanShell(File.separator,)}result_${__time(yyyyMMdd-HHmmss)}.xml

(make sure the Save to XML is checked in the Aggregate Report)


Apache JMeter note:
Don’t use GUI mode for load testing, only for Test creation and Test debugging!
For load testing, use NON GUI Mode & adapt Java Heap to your test requirements

Filed under Test Automation.

We’ve speed tested over 30000 websites and here are the speed test results after running the website speed tests:

Total: 30000 websites tested – Check how fast is your website for free

Response times between 0ms – 200ms
223 (<1%) websites with response time between 0ms – 200ms

Response times between 200ms – 500ms
641 (~2%) websites with response time between 200ms – 500ms

 

Response times between 500ms – 750ms
708 (~2%) websites with response time between 500ms – 750ms

 

Response times between 750ms – 1000ms
718 (~2%) websites with response time between 750ms – 1000ms

 

Response times between 1000ms – 2000ms
3794 (~16%) websites with response time between 1000ms – 2000ms

 

Response times between 2000ms – 3000ms
3521 (~11%) websites with response time between 2000ms – 3000ms

 

Response times between 3000ms – 5000ms
4961 (~16%) websites with response time between 3000ms – 5000ms

 

Response times between 5000ms – 10000ms
5641 (~19%) websites with response time between 5000ms – 10000ms

 

Response times between: greater than 10000ms
9793 (~32%) websites with response time between 10000ms

 

 

Only 7% of the websites tested have a response time lower than 1 second.

Also more than 50% of the websites tested, almost 15k websites, have a response time greater than 5 seconds.

A higher response time translates indirectly in potential customers leaving your website.
How to Improve Your Page Load Speed by 50% in less than 30 Minutes? Here are a few hints which can make a huge difference:
  • minify assets (JS files, CSS files)
  • minify HTML
  • use CSS Image Sprites
  • optimise images
  • use CDN for hosting images and other assets (fonts etc) – inspect latency
  • move JS files at the bottom of your HTML page and CSS files at the top
  • group multiple CSS files and JS files into a single (minified) CSS or JS file if possible
  • eliminate Render-Blocking JavaScript and CSS (Async Javascript)
  • rely on browser caching
  • remove unused widgets, plugins
  • improve server side hardware (DB queries, hardware, etc)
  • more details on increasing rendering speed
As you saw above, there are loads of things you can do to improve your website rendering speed. We also offer a free website speed test.
To get a better understanding and speed insights related to your website, create an account today with LoadFocus and run a full website speed test.

Filed under Selenium WebDriver, Test Automation, UI Testing.

If you want to open a new tab in the browser with Selenium WebDriver and Java, below we’ve listed some working examples. Have in mind that at the moment, Selenium WebDriver has no build-in ability to open new tabs or new windows, and because of this we have to force the browser to open the links in new tabs or in new windows. This may be implemented in a later version of Selenium WebDriver.

1. Open an existent link a a new tab using Selenium WebDriver and Actions

More details on how to locate web elements with Selenium WebDriver.

//identify the link in the page, that you want to open in a new tab of your browser's instance
WebElement link = driver.findElement(By.cssSelector(linkLocator));

//this action will click the WebElement with the link identified above, hold CONTROL Key (or COMMAND if you're using Mac), click the WebElement and relese the Keys.CONTROL (use Keys.COMMAND if you're using Mac).
new Actions(driver)
.keyDown(Keys.COMMAND)
.click(link)
.keyUp(Keys.COMMAND)
.build()
.perform();

The code above works in all browsers.

2. Open an existent link a a new tab using Selenium WebDriver with CONTROL/COMMAND Key and T

There is also another option that may not work in Chrome browsers at the moment because of a limitation in the way keyboard inputs are simulated in ChromeDriver. Keys are sent directly to the render process, so any keyboard shortcut in the browser process will not be invoked by sendKeys() method.

String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");

Keys chord(CharSequence… value) method – Simulates pressing many keys at once in a “chord”. Takes a sequence of Keys.XXXX or strings; appends each of the values to a string, and adds the chord termination key (Keys.NULL) and returns the resultant string. Note: When the low-level webdriver key handlers see Keys.NULL, active modifier keys (CTRL/ALT/SHIFT/etc) release via a keyup event.

The code below will open the link in new Tab.

 

driver.findElement(By.cssSelector("body")).sendKeys(selectLinkOpeninNewTab);

Then when you open a new tab in your browser, you have to switch to it to be able to work with the newly opened tab’s elements:

List tabs = new ArrayList&amp;amp;amp;lt;&amp;amp;amp;gt;(driver.getWindowHandles());
driver.switchTo().window(tabs.get(1));

In order to switch back to the first tab, Selenium WebDriver offers the ability to switch back to the first tab, by executing the following code:

driver.switchTo().defaultContent();

Quite often you may want to open a new tab in the same browser window that is running your Selenium WebDriver tests. Instead of opening a new browser, you can simply use the code below to open a new tab in the same browser:

String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,"t");
driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab);

You’d need to keep track of the window name(s) or ids to allow switching between them.

3. Open an existent link a a new window using Selenium WebDriver

//identify the link in the page, that you want to open in a new tab of your browser's instance
WebElement link = driver.findElement(By.cssSelector(linkLocator));

//this action will click the WebElement with the link identified above, hold SHIFT Key , click the WebElement and relese the Keys.SHIFT .
new Actions(driver)
.moveToElement(link)
.keyDown(Keys.SHIFT)
.click()
.keyUp(Keys.SHIFT)
.build()
.perform();

How fast is your website comparing to your competitor’s? Check now!

Filed under Load Testing, Performance Testing, Test Automation.

If you ever asked yourself “What is the difference between Performance Testing and Load Testing”, below are listed some of the main characteristics of Performance Testing and Load Testing, and how are they different from one another.

What is Performance Testing?

Performance Testing represents the characteristics of a system, how fast is that system, in general it refers to the tests undertaken to determine how that system behaves and performs.

Prerequisites for Performance Testing

We need to have clearly defined goals before starting any performance tests. The goals defined will help us if after getting the performance tests results there is a need for system improvement.

Performance Testing Results

After running performance tests, you need to inspect the metrics like response and latency times, hits per second, throughput per second, errors (client side metrics) and CPU, Memory, I/O (server side metrics) for the system tested.

Performance Testing Goals

Set a base line for the system under test for future releases and potential improvement of the system. It helps to identify potential bottlenecks, that can be found at different levels: system level (client and server side), DB level, network level.

Most of the times, running performance tests can be a very time consuming and hard job. First you need to set a base line for your tests, then you need to tweak the tests (number of concurrent users, duration and ramp up period between concurrent users).

Use LoadFocus to performance test your application from the cloud.

What is Load Testing?

Load Testing is understanding how the system behaves under high volume of transactions. Let’s say you send an email campaign to 10000 addresses and you want to understand how your system behaves when most of those 10000 potential users will access your applications.

Load Testing helps you simulate similar scenarios in an controlled environment, and the goal of load testing is to see whether the application can sustain the increased load on the server or will it crash the servers. Use LoadFocus to cloud load test your application.

Load Testing is usually started with a low number of concurrent clients (users) and gradually increased over a given period of time until it reaches the desired load on the system. During this period, client side and server side metrics need to be inspected.

We’ve only touched the surface in terms of potential issues, performance testing and load testing tools and techniques that deserve to be mentioned in the context of performance and load testing.

LoadFocus.com is a All-In-One Cloud Testing Platform for Load Testing and Performance Testing, Website Speed Testing, Automated Website Testing and Mobile Emulation for Websites, Mobile Applications and API Endpoints.

Filed under Selenium WebDriver, Test Automation.

We’ve created an Online Courses platform for each one of you who wants to learn something new in 2017. We’ve added video courses which will help you go from no testing knowledge to becoming a proficient automated tester, with loads of knowledge regarding setting up automation framework, to creating good UI functional tests and structuring your projects in a maintainable way.

Here are the steps that we recommend, in order to go from novice to a professional automation tester:

 

The Ultimate Selenium WebDriver Testing & Hands-on Guide (£100)Selenium WebDriver training

 

Ultimate Selenium WebDriver Testing & Hands-on Guide is a step-by-step interactive session that will handhold you all the way to understand software architecture, what should / should not be tested and where you should start.

 

 

Video Course on How to Select a Dropdown in Selenium WebDriverdropdown element online course

(£10)

Highlights all possibilities available to interact with a dropdown element with Selenium WebDriver, and it covers just the right amount of dropdown interaction details which are needed for automation.

 

 

 

Best Ways on How to Find XPath for Web Elements in Chrome andxpath online course

Firefox Browsers (£15)

 

XPath Online Course is a comprehensive, yet simple course and it concentrates on identifying XPath for web elements in an very effective way.

 

 

 

How To Write Faster Selenium WebDriver Tests (£10)faster webdriver tests online course

How To Write Faster Selenium WebDriver Tests video course concentrates on best practices for identifying ways to improve your automated tests.

 

 

Jenkins CI Installation and Deployment on Mac and Ubuntujenkins online course

(hands-on video course) (£28)

 

Create, configure your first Jenkins job, and run it (debugging results and console logs are also provided)

 

 

 

Learn JMETER from Scratch for Performance Testing andjmeter online course

Load Testing (Hands-On Guide) (£48)

 

Apache JMeter Load Testing Online Course is a hands-on, yet simple course and it concentrates on identifying starting to use Apache JMeter to load test any website or web service.

 

 

With the above online video courses you’ll get enough knowledge to start your journey into becoming a better tester, more efficient and with loads of hands-on knowledge.

The online video courses are provided by LoadFocus Courses platform.

Filed under Test Automation.

We are already in the new year, and we have greater hopes and expectations comparing to the previous one.

There is no better time to start thinking of your personal development and setting up new goals for 2017.

Here is a list of online testing courses that’ll help you develop in new areas, improve your testing skill and be more effective and efficient at your daily job:

The online video courses are provided by LoadFocus Courses platform.

Filed under Test Automation.

While testing different applications you will get to the need of testing the following scenario:

The user is opening the application, clicks the Overview button which sends the application
to background and reopens the application by choosing it from the recent used application.

To be able to do that you need to know how to implement two important actions:
1. Click the Overview button which send the application to background; for doing this you can use the following
code snippet written in Java:

    public void clickOverviewButton(){
		((AndroidDriver<WebElement>)driver).pressKeyCode(AndroidKeyCode.KEYCODE_APP_SWITCH);
	}

2. Reopen the application from the recent applications; for doing this you can use the application name like in the following example written in Java:

    public void clickRecentAppByText(String appText){
		waitForElementByText(appText, 10);
		driver.findElement(By.xpath("//*[@text=\"" + appText + "\"]")).click();
	}

Hope this helps with your daily testing tasks. Details on how to use the Overview, Home and Back buttons in Appium for Android