Wednesday, 6 January 2016

Basic Structure Of Senuji Test Script

 

Introduction

As I explained before Senuji is a Keyword driven wraps around Selenium. Senuji has set of Keywords witch calls Selenium functionality and execute during run time. For this Senuji Keyword needs two main components.
  1. Value attribute witch carry parameters to actual selenium run time.
  2. Locator/Object attribute witch carry the HTML object information to actual selenium run time.
Senuji has stranded syntax to manage above attributes. Evey Senuji Keyword looks like following
KeyWordName[Space]"Value attribute"[Space]"Locator/Object attribute".

My First Senuji Test Script


For example, Assume we want to Google.lk web site in Fire Fox Browser. Then I need to create a Project and  Test Script as per my previous post How to create Senuji project and run.

Then I need to go to Keyword List and select Open Keyword and Enter Google.lk URL into Value TextBox. Please refer to below screen shots

 

Now Click Add New Line Button. Then Senuji Keyword will be automaticaly compute and Keyword will be added as a script line to active script.




Now for example say you want to wait until Gmail Link appear in the browser. For this I am going to use Senuji Keyword WaitForElementPresent. WaitForElementPresent requires Object/Locator of the Gmail Link. I use Fire Path object spy to understand the object and enter it to Senuji Object TextBox.




 Fire path object spy helped me to identify Locator for Gmail link. It class="gb_P". Now I am going to select WaitForElementPresent from Keyword List and select Class Name as Locator type from Locator type combo box and locator ID "gb_P" in to object textbox. However
WaitForElementPresent dose not require value parameter so I am keeping it as blank.





Now I click add new line button. Now WaitForElementPresent Keyword will be appended into our existing script.




Now assume I want to read caption "Google.lk offered in: සිංහල தமிழ்" exists in the page. For this I use Fire path spy to identify the object of the caption.



Then I use ValidateObjactValue keyword. I pass expected result of  "Google.lk offered in: සිංහල தமிழ்" into Value Textbox and select Locator type as ID and Object ID into Object Textbox and click Add new line button



Now I am going to save the test script as My First Test and Project as My First Project and run the script using Run Script Button. Just to show the fail scenario, I have changed the expected results of ValidateObjactValue. Now I am expecting a Fail in ValidateObjactValue. 

Now you can see the detail test log in Log section and Summary as a pie chart.





How to Create Senuji Project and Run









Senuji Project file contain your test scripts, Video recordings, Screen captures, External Data files and etc. File extension is .sep and projects are save in your Default Save Path you set during settings.

How to Create Senuji Project and Run

  1. Click New Script (M) icon from test script aria
  2. Select the keyword from keyword list (K) Example "Open"
  3.  Enter Value for the selected keyword using Value Textbox. (I) Example "www.Google.com"
  4. You can enter locator/object value using Target object Textbox (j) Example "//*[@id='lst-ib']"
  5. You can select locator type from Locator Combo box. (L) Example Xpath
  6. Click Add New Line Button (O) to add the line to active script.
  7. You can add any number of lines to a script box
  8. If you remeber the sysntax of the keyword you can type directly into script box.
  9. Click Run button (H) to execute active script.
  10. Click Save Button (N) to Save active script. Saved scripts will be added to Project Aria
  11. You can save all script into one project by Save Project button (C)
  12. You can Open a Project using Open Project Button (A)
  13. List Video Button (D) will open all Video recordings for the open project. Videos will be saved to the project when you click Save Project Button.
  14. List Screen Shot Button (E) will open all Screen shots for the open project. Screen shots will be saved to the project when you click Save Project Button.
  15. List Data Files Button (F) will open all Data Files for the open project.Data Files will be saved to the project when you click Save Project Button.
  16. When you run the project Test results will be log to Log Aria. You can clear the log using Clear Log Button (P) or You can Save the log using Save Log Button (Q)  
  17.  Please refer Image 2 for Sample Screen shot of a Test Script and Test results
  18.  Please Refer to Image 3 for Sample Test Script 


Image 2: Senuji Project View




This Script will open google page and wait for Gmail link and other objects in the page. Then it will open Test.cvs file and input 1st data element into google search box and wait for 3000ms. Then it will input the next record and loop until EOF.

Image 3 : Sample Test Script








Tuesday, 5 January 2016

How to Install Senuji



1. Make sure you have Java 1.8 or higher in your PC and it is accessible to Senuji. Please note that as of now Senuji is tested only on Windows. Therefore we are officially supporting Windows only.

 

2. Copy downloaded Senuji archive to your hard drive
3. Unzip the archive
4. Run Settings.jar by double click Settings.jar
5.Create a Folder for Senuji to use during execution and select the folder location as Default Folder in Settings
6. When you unzip Senuji archive you see a folder call System. Please select System folder location as System Folder in Settings
7. Create a Folder for Senuji to use as defect save location and select it as Project Save Path in Settings
8. When you unzip Senuji archive you see a folder call Driver. Select that location as Chrome Web 9.
Driver Location in Settings. If you have Chrome Web Driver installed Please select that location
9. When you unzip Senuji archive you see a folder call Driver. Select that location as MS Web Driver Location in Settings. If you have MS Web Driver installed Please select that location
10. Enter a Default Project name and Script name
11.Click Save button to save your settings 

12. Double click Senuji.jar to open Senuji main screen.
 

Senuji Web Testing Framework - Introduction

 

Introduction

Senuji is my second QA initiative. After Manuji's success as a tool I through of helping the QA community, especially guys who intersected in WEB test automation. (Lots of people asking me what is the meaning of  Manuji. Manuji is my first daughter and Senuji is the second. They are twins)

Selenium is the best web test automation tool affordable to most of us. However as you know it require some programming capability with Java and some technical know-how about java.  Lots of QA guys are lacking programming capability but they want to use the power of Selenium.  I designed Senuji to assist such people.

Senuji is a keyword driven Selenium based test automation framework witch designed to cut down Java programming complexity. Senuji can be very useful to test automation starters or none technical testers to use the power of Selenium test automation capabilities.

Senuji is hosted on https://sourceforge.net/projects/senuji-web-testing-framework/ . These days I am in the process of preparing the site and  getting ready for the first beta release of Senuji.

 

Senuji has following built in capabilities witch provide advanced test automation features instantly with zero Java and Selenium know-how.

1. Advanced cross browser test execution ability without changing Senuji test script
2. Advanced exception management capability during test run
3. Complete and durable logs and test reporting
4. Full video coverage of your test run
5. Easy to use keyword library
6. Instant help facility once you select the keyword.
7. Easy installation (Just extract the archive file)


Features


  • External Data Handling Capability
  • Advance Exception Management
  • Full Video Coverage of a Test Run
  • Script Level and Suite Level Test Execution
  • Full Functional Looping Ability
  • Screen Capture Capability
  • Comprehensive Keyword Library
  • Easy Installation
  • No Java or Selenium Knowledge required

Release Plan

I am planing to release my first version to SourseFroge by mid of January 2016. You all can download the release form https://sourceforge.net/projects/senuji-web-testing-framework/files/ 

Wednesday, 5 August 2015

What is Duplicate Content and How to Test Duplicate Content Effectively

 On the web, clients and servers perform every interaction by passing HTTP Messages between them. To download a resource from a server, a client initiates a client/server transaction by sending the server an HTTP Request Message. The header of an HTTP Request Message contains details associated with the request. In response, the server packages the requested and sends it to the client as HTTP Response Message. This round-trip exchange constitutes one Request/Response transaction. The entire conversation usually last several minutes, and is referred to as a Session.

 What is Duplicate Content?

In simple duplicate content is requesting and receiving same set of data form your back-end systems as resonance message. Each time a client requests content from a server, the server returns it as an HTTP Response Message.

Imagine saving Response as they arrive from the server. By the end of the session, you would end up with a collection of Response Entities. If you checked this collection for duplicates, that is, for Entities that contain the exact same content you would probably find some, perhaps many.
Since every content request results in a Full Response from the server, eliminating the Full Responses that result in duplicate content also eliminates the associated overhead for the Full Response, which includes:
  • The time it takes for the Request Message to reach the server, for the server to fill the request, and for the Response Message to return to the client.
  • The wireless bandwidth consumption.
  • The Battery drain from using radio resources.
Eliminating duplicate content provides benefits to an individual user, such as:
  • Improved application responsiveness.
  • Longer lasting battery charge.
  • Reduced impact on the user's data plan.
It also provides benefits to all users by improving throughput due to the cumulative effects of the reduction in bandwidth usage, and the reduction in processing overhead on the web server.

What is the solution for Duplicate Content?

This problem can be solved by incorporating a caching strategy into your client application design. The cache is a process operates as a middle-man standing in between the client and server processes. The cache serves locally-stored copies of Response, so you can refer to it as a Response Cache.

There are several ways to implement caching. There are libraries available for this, and some operating systems have functions for it, but the most direct approach is to incorporate Response Entity Cache functionality into your client software code. Caching is important to your application for the following reasons:
  • Cached files are available immediately, with no download latency. This makes your application appear faster.
  • Battery life. Every data connection drains the device's battery. If battery draining appears too excessive, the application may be uninstalled by the user.
  • Data caps. Users have monthly data caps, and resending files over and over can result in additional costs to your customers if they exceed their monthly data allowance and incur overage charges.
  • Citizenship: Wireless networks have limited capacity. If you clog the network with extra data, it hurts the responsiveness of all applications (as well as phone calls).

 How to test Duplicate Content?

Testing for Duplicate Content is simple and does not require much technical expertise. There are several tools available and they can help you to find Duplicate Content and its implications. I will     show you how to test Duplicate Content using AT&T ARO.

Following test scenario I used to find how effectively my AUT is using caching strategy. So I check for my AUT is programed to cache or retain frequently used downloadable content such as Images, Audio, and XML. An application should not download more than 3 duplicate items as displayed in the Caching: Duplicate Content test in the ARO Data Analyzer help you to find following

  • Caching is present but is not being utilized correctly.
  • ETags in HTTP headers not being utilized correctly.
  • Cache headers not established. See Cache Control Test ID 1.2.
  • HTTP expiration model not being utilized. See Content Expiration Test ID 1.3.
 Test Steps: This test can be tested as part of an Active User ARO test
  1.  From the ARO Data Collector, open task killer and kill all tasks.
  2.  Hide Collector and Launch the app under test.
  3.  Utilize the app under test for 20 minutes. Navigate through the application at a pace that would emulate a real user. Cover all the states that are applicable to the app including:
    • Moving back and forth between multiple screens within the application
    • GPS State
    • Bluetooth State
    • Screen Rotation
    • Intentionally navigate back through the application to a screen that has been visited previously in the trace.
  4.  Stop trace in the ARO Data Collector
  5.  Transfer the trace to the ARO Data Analyzer

  Pass / failure Threshold:


Pass
Not the most efficient result possible, but unlikely to cause significant user dissatisfaction
Definitely inefficient, likely to cause effect that will be noticed by the user in terms of network delay, battery usage or data consumption
Extremely inefficient, likely to have unacceptable user impact in terms of network delay, battery usage or data consumption
ARO Green icon
The lesser of5% of total content or 0.5 MB of data
The lesser of 5% - 20% of total content or between 0.5 MB – 2.0 MB of data
More than 20% of total content or more than 2.0 MB of data


Sunday, 19 July 2015

Minimizing Mobile Application Energy Consumption with Cloud Offloading Concept.

Lots of people in mobile testing talks about monitoring mobile energy consumption and related defects. I am also a person who keen on reducing mobile energy consumption. However during my past experience, whenever we raise a defect on energy consumption people don’t take them serious. They always say this is a job of a mobile device and OS should manage energy not our app/AUT.

Recently I found a white paper from Young-Woo Kwon and Eli Tilevich who discussing a concept call Cloud Offloading witch actually focusing on reducing mobile application energy consumption and allow mobile application user to be mobile more time by reducing recharging frequency  I will point following key highlights of this paper in order to increase your interest and you may download the paper from  www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB0QFjAAahUKEwjzvKjG_ejGAhVQ1I4KHT1HCpY&url=http%3A%2F%2Fpeople.cs.vt.edu%2Ftilevich%2Fpapers%2Ficsm2013.pdf&ei=pYesVbPWEtCouwS9jqmwCQ&usg=AFQjCNG-0olac3mfTIju7kq1YFwSE963nA&sig2=LOzJAuqhaZ9DcJSq3hD91g&bvm=bv.98197061,d.c2E 

What is cloud offloading

“Cloud offloading, this optimization partitions mobile applications, so that their energy intensive functionality is executed in the cloud, without draining the battery”

Problem Definition

After discovering that the network conditions in place can significantly affect how much energy is spent to transfer the same data, we have created guidelines for mobile application designers to transmit data in a fashion that consumes the least amount of energy for a given mobile network. Because transferring the same data over WiFi, 3G, or 4G networks consumes different amounts of energy, an optimal offloading mechanism should be adaptive, transferring varying amounts of state depending on the network conditions in place.

Figure 1 shows an Cloud Offloading Energy Consumption Graph (CO-ECG), a novel program analysis data structure that we introduced to model how much energy will be consumed under different offloading scenarios.

In this particular CO-ECG, component A consumes approximately 100 joules during a typical execution, thus becoming a viable candidate to be offloaded to the cloud. Because component A calls components C and B, which in turn calls components D and E, its energy consumption is the sum of the energy consumed by all the successor components in the graph. We assume that the energy spent on executing the offloaded functionality in the cloud is free, as it does not exhaust any battery power of the mobile device. If component A is offloaded, then transmitting the necessary data to it across the network enabling it to execute remotely would consume between 30 and 150 joules depending on the type of the

network available to transmit the data. In other words, under some network conditions, offloaded execution will end up using more energy than executing component A on the mobile device. Because the type of network available is only known at runtime, the offloading decisions must be dynamic to be able to optimize the amount of consumed energy under all runtime conditions.

Approach Overview

Figure 2 shows the workflow of AMCO. The approach consists of two major parts—a program analysis-guided partitioning transformation and an adaptive runtime system. The AMCO programming model is straightforward: the programmer marks the components suspected of being energy hotspots. In AMCO, components can be defined at any level of program granularity, with the smallest being individual methods and the largest a collection of packages. To mark hotspot components, AMCO provides a special Java annotation @ OffloadingCandidate; this information can also be specified through an XML configuration file. Based on this input, an analysis engine first checks whether the specified component  can be offloaded as well as any of its subcomponents (i.e., successors in the call graph).