Where we learn technology

Author: Naveen AutomationLabs (Page 4 of 7)

How To Figure Out What To Test

How To Figure Out What To Test

The Problem

There is a lot to figure out when it comes to automated web testing, but where do you start? And if you’ve already started, how do you know you’re on the right track? And how do you avoid testing everything in every browser without missing important issues?

A Solution

A great way to increase your chances of automated web testing success is to map out a testing strategy. And the best way to do it is to answer these four questions:
  1. How does your business make money?
  2. How do your users use your application?
  3. What browsers are your users using?
  4. What things have broken in the application before?
NOTE: for organizations that don’t deal directly in dollars and cents (e.g. non-profits, federal agencies, etc.) you should focus on how the application generates value for the end user.
After answering these questions you’ll have a firm understanding of the critical functionality and relevant browsers for the application you’re testing. This will help you focus your test automation efforts on the things that matter most. 
You’ll want to keep track of these items somehow — the recommended approach is to use a prioritized backlog.

What To Do With The Answers

Question 1 – Money/Value

Every company’s application makes money (or generates value) through a core set of functionality — a.k.a. a ‘funnel’. Your answers to this question will help you determine what functionality makes up the funnel. This will be your highest priority for test automation.

Question 2 – Usage Data

There can be a big difference between how you think your application is used, and how yours users actually use it. And odds are your application offers a robust set of functionality that grows well beyond the core functionality of the funnel.
Your answers to this question will help you determine what features are highly used and lightly used. Tack the highly used items onto your automation backlog based on order of use below the answers to question 1.

Question 3 – Browsers

Now that you know what functionality is business critical and widely adopted by your users, you need to determine what browsers to focus your automated web testing efforts on. Your usage data will tell you this as well. It will help you determine which browsers you can reasonably avoid testing in (e.g. based on non-existent or low usage numbers). 
Note the top 2 browsers (or 3 depending on your numbers), but focus on the top 1 for now. This is the browser you will start writing your automated tests in.

Question 4 – Risky Bits

To round out the strategy it is best to think about what things have broken in the application before. You might be able to glean some of this information from a defect tracker. But the best information is often in the minds of your colleagues. Ask around and see what they say.
What you come up with will likely read like a laundry list of browser specific issues or functionality that has been flaky or forgotten about in the past. Be sure to check this list against your automation backlog. If you’ve come across something that’s not already in the backlog, add it and put it at the bottom. If it is there, make a note in the backlog item that this has been an issue in the past. And if the issue has happened numerous times and has the potential to occur again, move the item up in the backlog priority.
If issues keep cropping up that are related to a specific browser, compare this browser to your short list from question #3. If it’s a browser that’s not in your list but it’s a small pocket of high value users, track it on the backlog but put it at the bottom.

Now Your Are Ready

Having answered these questions you should now have a prioritized backlog of critical functionality that’s backed up by usage data, a short list of browsers to focus on, and an understanding of the risky parts of your application. With it you can make sure you are on the right track with your test automation (regardless if you’re just getting started with test automation or already have a mature test automation practice).

Outro

Hopefully this strategy will help you focus your testing efforts, avoid wasting time, and increase your confidence in the approach you are taking.
This strategy works best for applications with existing functionality and does not speak directly to testing new functionality that’s being actively developed. That’s not to say that the two couldn’t co-exist. It largely depends on your available resources and pace of development. But in order to reach high quality at speed, you first have to go slow.
Cheers,
Naveen AutomationLabs

Mystery of StaleElementReferenceException in Selenium WebDriver

Mystery of StaleElementReferenceException in Selenium WebDriver


If you are a Selenium developer than you would have surely faced this mysterious exception called “StaleElementReferenceException

Why exactly it occurs? This has been my favorite interview question since last many years and most of the time candidates gets confused it with NoSuchElementException. In case you have never worked on a dynamic ajax based application then there could be a chance that you have never faced it.
Let’s go little deeper and unveils the mystery behind it. When we run a simple code like this:
WebElement searchBox = driver.findElement(By.cssSelector("input[name='q'"));
searchBox.sendKeys("Selenium");
When WebDriver executes the above code then it assigns an internal id (refer the below image) to every web element and it refers this id to interact with that element.
Example image
Now, let’s assume when you have fetched the element and before doing any action on it, something got refreshed on your page. It could be the entire page refresh or some internal ajax call which has refreshed a section of the dom where your element falls. In this scenario the internal id which webdriver was using has become stale, so now for every operation on this WebElement, we will get StaleElementReferenceException.
To overcome this problem, the only choice we have is to re-fetch the element from Dom and this time WebDriver will assign a different Id to this element.
So from the above example what we understood is that if we are working with an AJAX-heavy application where page’s dom can get changed on every interaction then it is wise to fetch the web elements every time when we are operating on them. There are couple of ways to make sure, the element always gets refreshed before we use it:

Page Factory Design Pattern:

Please refer the below code.
GoogleSearchPage page = PageFactory.initElements(driver,GoogleSearchPage.class);
public class GoogleSearchPage {
@FindBy(how = How.NAME, using = "q")
private WebElement searchBox;

public void searchFor(String text) {
searchBox.sendKeys(text);
}
In the above example, a proxy would be configured for every Web Element when the page gets initialised. Every time we use a WebElement it will go and find it again so we shouldn’t see StaleElementException. This approach would solve your stale element problem at most of the places except some corner cases which I will cover in the next approach.

Refreshing the Element whenever it gets stale:

When you work on a modern, reactive, real-time application developed in technologies like Angularjs/Reactjs which has hell lot of data and there is a persistent web-socket connection which keep pushing data to your browser and which makes your dom to change. Let’s take an example of a stock exchange where there a data grid which displays real-time information and data keeps changing too frequently. In this case, whenever the data gets changed at server-side, the changes will be pushed automatically to your UI grid and depending on your data your respective rows or cells will get stale.
Here, Page factory can not help as most of your grid elements are dynamic and you cannot configure their locators while initiliazing your page. Also if you have created your own data model to prase data, than it is difficult to configure Page Factory accross all your data model classes.
To deal with this problem I decided to develop a generic method to refresh the element in case it gets stale. To refresh an element, we first need to figure out its By locator but Selenium API has not exposed anything to re-construct the locator from an existing web element. I was fortunate that they have exposed a toString method on WebElement which print all the locators being used to build that element. Let’s see the below example where we are finding an element which is a child of another element:
WebElement elem1 = driver.findElement(By.xpath("//div[@id='searchform']"));
WebElement elem2 = elem1.findElement(By.cssSelector("input[name='q'"));
System.out.println(elem2.toString());
Output of the above code would be:
[[[[ChromeDriver: chrome on XP (bd6a0d83229c67d5f7e6060b1bd768e9)] -> xpath: //div[@id='searchform']]] -> css selector: input[name='q']
Now we have to apply all the reverse-engineering to build the element again from this String. Thanks to Reflection API in Javawhich can help us to dynamically execute the code to build the element.
Here is the final implementation:
WebElement refreshedElement = StaleElementUtils.refreshElement(elem2);
This refreshElement method will check if the element is stale then it will re-fetch the element from the dom. So for all the data grid elements which can get stale anytime, we can use this method as a precautionary measure to avoid stale element exception.
Please feel free to share your thoughts on my approach and would love to know, how you have handled this interesting exception.
import com.sahajamit.selenium.driver.DriverManager;
import org.openqa.selenium.By;
import org.openqa.selenium.StaleElementReferenceException;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
public class StaleElementUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(UIUtils.class);
public static WebElement refreshElement(WebElement elem){
if(!isElementStale(elem))
return elem;
Object lastObject = null;
try{
String[] arr = elem.toString().split(->);
List<String> newStr = new ArrayList<String>();
for(String s:arr){
String newstr = s.trim().replaceAll(^\[+, ).replaceAll(\]+$,);
String[] parts = newstr.split(: );
String key = parts[0];
String value = parts[1];
int leftBracketsCount = value.length() value.replace([, ).length();
int rightBracketscount = value.length() value.replace(], ).length();
if(leftBracketsCountrightBracketscount==1)
value = value + ];
if(lastObject==null){
lastObject = DriverManager.getDriver();
}else{
lastObject = getWebElement(lastObject, key, value);
}
}
}catch(Exception e){
LOGGER.error(Error in Refreshing the stale Element.);
}
return (WebElement)lastObject;
}
public static boolean isElementStale(WebElement e){
try{
e.isDisplayed();
return false;
}catch(StaleElementReferenceException ex){
return true;
}
}
private static WebElement getWebElement(Object lastObject, String key, String value){
WebElement element = null;
try {
By by = getBy(key,value);
Method m = getCaseInsensitiveDeclaredMethod(lastObject,findElement);
element = (WebElement) m.invoke(lastObject,by);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return element;
}
private static By getBy(String key, String value) throws InvocationTargetException, IllegalAccessException {
By by = null;
Class clazz = By.class;
String methodName = key.replace( ,);
Method m = getCaseInsensitiveStaticDeclaredMethod(clazz,methodName);
return (By) m.invoke(null,value);
}
private static Method getCaseInsensitiveDeclaredMethod(Object obj, String methodName) {
Method[] methods = obj.getClass().getMethods();
Method method = null;
for (Method m : methods) {
if (m.getName().equalsIgnoreCase(methodName)) {
method = m;
break;
}
}
if (method == null) {
throw new IllegalStateException(String.format(%s Method name is not found for this Class %s, methodName, obj.getClass().toString()));
}
return method;
}
private static Method getCaseInsensitiveStaticDeclaredMethod(Class clazz, String methodName) {
Method[] methods = clazz.getMethods();
Method method = null;
for (Method m : methods) {
if (m.getName().equalsIgnoreCase(methodName)) {
method = m;
break;
}
}
if (method == null) {
throw new IllegalStateException(String.format(%s Method name is not found for this Class %s, methodName, clazz.toString()));
}
return method;
}
}

WHY SHOULD WE USE JMETER FOR PERFORMANCE TESTING

WHY SHOULD WE USE JMETER FOR PERFORMANCE TESTING

JMeter is one of the most popular, open source performance testing tools among the software testing professionals around the world. There are number of reasons for JMeter to be popular. We shall share some of the reasons in this post.

Scripting knowledge is not required to build test plans

Test scripting is not essential to build performance testing test plans. Test plans can be built by adding and configuring  available components in JMeter IDE. This allows beginners to create effective performance test plans without any scripting.
Learning or mastering a tool is not sufficient for a successful performance testing projects. Good understanding of the context, test planning, test design, test execution and test reporting is essential for a successful performance testing project.

JMeter supports multiple scripting languages 

JMeter do support the scripting. Advance users can use the scripting (example Java, Groovy, BeanShell scripting) to extend the ability of JMeter.
JMeter support number of scripting languages out of the box. It can support JSR223-compatible languages not configured with default settings. There are other languages supported than those that appear in the component drop-down list. Others may be available if the appropriate jar is installed in the JMeter lib directory

JMeter is free and open source

JMeter is an Apache project. The source is available to the community. JMeter source code can be modified and built for specific needs if required.

It can run on any platform 

JMeter is developed using Java. Java applications can run on any platforms. Hence JMeter can be used on Windows, Mac , Linux or any other operating system when compatible JVM is available. 

Free support 

There is a huge community around the tool. There are active user groups in LinkedIN, Facebook , StackOverflow etc. Questions are answered within acceptable time period. The users can rely on the community for support questions.
There are organizations who provides commercial support too. 

Customized reports can be generated 

Reporting is one of the poor feature available in open source tools as compared to the commercial tools. Fortunately JMeter supports various reporting formats through available listeners and plugins. Also the test results can be upload to external reporting tools and generate commercial grade elegant reports.
There are number of listeners available out of the box for saving the test results. Test results can be loaded into the listeners to view the test results later too. 
The test results can be loaded into third party tools (example blazemeter ) and generate the test reports.
There are number of plugins available for reporting.

Real world workloads can be simulated

It is possible to simulate various workloads using ThreadGroups, timers ,Logical controllers and config elements. Different users’ dynamic thinking timing can be simulated using wide range of available timers and third party plugins 
User concurrency ,number of virtual users can be simulated using thread groups.
Throughputs ,

JMeter supports many protocols

Jmeter supports not only the web applications.  It supports wide range of applications, protocols and servers. Here is the list extracted from the official site.
  • Web – HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
  • SOAP / REST Webservices
  • FTP
  • Database via JDBC
  • LDAP
  • Message-oriented middleware (MOM) via JMS
  • Mail – SMTP(S), POP3(S) and IMAP(S)
  • Native commands or shell scripts
  • TCP
  • Java Objects

Easy to create the test plans

Test plans creation can be started with recording feature available with JMeter. Also BabBoy software can be used for exporting the recorded flows into JMeter test plans. Some commercial tools based on Jmeter can be used for creating the JMeter scripts easily. Fore example Blazemeter’s Chrome plugin.

Distributed Testing 

JMeter can be used for simulating large number of users accessing the system concurrently or simultaneously. Virtual users will have to be distributed among few load agent as one machine may not be able to create all required threads (virtual users)

Mobile application testing is supported 

JMeter can be used for recording the requests sent from the device to the servers through its proxy configuration. Hence JMeter can be used to record the requests from mobile applications and web applications running on Android and iOS devices.

Comprehensive documentation 

JMeter has comprehensive documentation available online. It covers from installation, configuration, creating basic test plans , components reference, best practices , extending JMeter and much more. 
Component references, function references etc can be accessed readily from context menu, shortcuts or menu. A copy of user manual and api documentation is shipped with the installation and available for offline access.

User friendly IDE 

JMeter GUI is very user friendly. Components can be added by just right clicking a node in the test plan. Components can be configured easily by filling the placeholders (input boxes ). 
GUI can be customized further for user need by configuring the properties ( in bin/JMeter.properties file). For example toolbar  display, look and feel, proffered GUI language can be customized by updating the respective properties in the property file.

Free learning material

A beginner can start with JMeter through self 
There are good collection of free online documentation , blogs , Q&As and videos available. There are paid online and public training programs available around the world.

Third party plugins

JMeter capabilities can be extended through pluggable components (samplers , timers , listeners etc). Free custom JMeter plugins can be accessed from https://jmeter-plugins.org/. The plugins can be managed (install, uninstall) easily through the plugin manager interface.
User has access for commercial plugins covering custom features. For example UBIK Load Pack Plugins. https://ubikloadpack.com/. UBIK also do custom JMeter plugin development on demand too. 

Highly customizable

Have QA testers lost respect?

Have QA testers lost respect?







With the increase in the need for speed to market and the popularity of more flexible agile software methodologies, the large QA team has largely disappeared over the past 20 years. Those 50-to-100-person QA teams—with separate management, directors, and full testing cycles—are mostly gone.
Large teams still exist in some cases, but they’re mostly in businesses that are highly regulated, where QA testers help verify that requirements and quality processes are met.
For the rest of us—the QA software testers who are now part of development teams—the change has been interesting. In many of today’s leading technology companies, the shift away from more formal QA software testing practices is widespread.
Is the QA profession losing respect or being replaced in the name of speed and efficiency?

No respect lost: It’s about productivity

Overall, the change from large, independent QA teams to QA team members as coders, or as testers within a development team, is not due to a loss of respect for the QA profession. It’s a cost and efficiency improvement.  
Does any company hire a QA tester first? No. It hires developers and product managers first. Is that a lack of respect? No, it’s realistic. After all, the application has to be developed and exist before QA testing is even necessary. Granted, the sooner the QA testing starts, the more time testers have to learn the system as it’s being developed.  
In today’s reality, if a QA tester is hired at all, it’s typically right before an application is set to initially release. Perhaps that’s a loss of respect for the business value of a QA tester. But consider that the company has hired a QA software tester, and that act alone—regardless of the timing—means management believes there is value in QA testing.  

Testing pro wanted: What’s in a job description?

Over the course of my career, I’ve experienced both working on large QA teams and being an independent QA tester assigned to one or more agile development teams. I wholeheartedly prefer the latter. 
The QA professional is a software development team member who performs manual, feature, and functional testing. The QA pro who focuses on QA—as in auditing compliance with regulatory requirements—is a separate function.
Large software companies such as Google, Facebook, and Microsoft use SDETs—software development engineers in test—to create unit and automated tests at the code level. Any additional testing, for features and functionality, is performed manually. Software testing is also largely done continuously these days, rather than during a defined test cycle.
Exploratory testing is the modern manual testing technique most used in practice. It is valuable for regression testing, as well as for testing features (requirements or acceptance criteria for stories), and for general system functional testing.

Why large teams fail

Large QA testing teams fail because they’re simply not efficient or effective. Software testing is an integral part of development, not a separate function. Politics among managers, leads, and QA members means that leadership, QA processes, and functions are constantly changing to the point of consistent chaos within large teams. 
No one QA tester can keep up with testing and the need to learn and apply automated testing, along with the constant change of QA process requirements and demands to keep up with manual testing simultaneously. What happens in large QA teams is that every team member forges his or her own path.
In other words, you develop a personal test methodology that best suits your understanding of the application, personal integrity, and ability to work constructively with development. You function inside the team, but every QA is marching to his or her own drum, attempting to focus on testing rather than the persistent, chaotic static from large QA team management.  
Today’s application development companies are focused on efficiency, costs, and results. Testing effectiveness is hard to prove, but proving that testing is worthwhile is not difficult. The QA profession losing respect is less about testing being unnecessary and more about being effective at finding relevant defects quickly and continuously.
QA respect is literally bound into results. How many and what types of bugs are found? How is QA helping developers create successful features? How often does a QA ask questions about the application design before or during development? QA respect is gained by proving QA testing is a worthwhile cost to the company.


Who needs testers?

Development and testing are separate functions, but they can be combined, as they often are, when a QA professional becomes an SDET. SDETs create code-based automation scripts and likely code when needed, and they test manually as necessary. The problem with relying solely on developer-based testing is that developers design code, test their code, and merge the code into a build.  
Developers generally tend not to use the application as an end user but focus on how the code executes in the background. Same with automated test developers. In practice, it becomes more important to management to meet deadlines, and over time, it is more important that unit and automated tests pass so the application can release, rather than verifying that the end-user experience performs as expected.  
The missing piece is an independent test of the application functionality performed by a resource who did not create it and isn’t responsible for making sure the automated and unit tests pass.   


Tips for proving a QA tester’s worth

Being the QA tester on a development team ensures that you’ll need to prove your worth by testing with an end-user perspective—not by counting defects entered or reported by customers, but rather by becoming an active, integrated team member focused on testing for the end user. In order to prove that QA testing is valuable, you need to find workflow or integration defects in the application and be able to constructively work with developers to correct them.  
The psychology of testing comes into play when you feel threatened, or less than others. Start by dropping the ego. Let go of the need to be the most important resource in the company, and be secure in your knowledge and your function as a tester. Ask questions of everyone on the team when you don’t understand a story, a fix, or even the acceptance criteria. Bring it up when there are contradictions in the story, or when you see that a developer and a business analyst or product manager are not on the same page. Focus on protecting the end user from defects, regardless of the cause.
QA testers must be courageous and secure with their professional worth. It’s okay if you’re wrong. You’ll gain more by asking questions, dumb or otherwise, then you will by worrying about whether your role is respected. Don’t stop at asking questions; listen to the response, fully and completely. By asking and listening, you’re respecting your team members’ knowledge and encouraging a work rapport. Respect is earned over time. QA testers gain respect by preventing end-user defects.  
Improve your QA testing worth by not avoiding difficult testing tasks. Don’t be the QA who only tests the surface of the application repeatedly. Stretch your abilities, and tackle the hard, brain-pounding items with enthusiasm. Take opportunities to expand your skills and understanding.  
I often see QA testers avoid a story or project that’s difficult—whether it’s the developer doing the work or the subject matter. QA respect is gained from hard work and perseverance. Remember to let go of your ego, set your priorities, and test. Ask, listen, and learn, and don’t fear being honest when you don’t understand. Respect is earned over time and by not being afraid to tackle difficult testing tasks.  
QA testers who lose professional respect are those who:
  • Sit back and let others do the work.
  • Surf the Internet or waste time while they wait for stories to come through, rather than continuing to test or testing continuously.
  • Don’t stretch their abilities and only want the easy items.
  • Restrict how many tests they’ll execute.
  • Are always afraid to bring up questions and concerns or to express ideas.
  • Blame the developer, business analyst, or product manager for defects.
Do the profession a favor: Test your heart out, tackle anything, and let your ego go, so you can work with other team members at a quick, constructive pace and provide the highest business value. That’s how testers will continue to command respect.

Cheers!
Naveen AutomationLabs

Test Cases – Game Testing – By Naveen AutomationLabs

Test Cases – Game Testing



Mobile Game Testing
Check for background music
and sound effects
ON/OFF sound & background music
Receive the call and check
Verify if sound effects are in sync with action
ON/OFF device sound(native sound) and check
Check for vibration effect if present
User Interface Check in Landscape/Portrait mode
Check for animation, movement of character, graphics, Zoom In/Out (all gestures) etc
There should not be any clipping (cutted background)
Test whether one object overlaps with another
Verify if loading indicator is displayed wherever required
Character should not move out of the screen/specified area
Test for enable and disable images/icons/buttons etc
Check for screen title
Check for message title, message description, label (should be appropriate)
Check scrolling
Font displayed (color, size etc)
Check other objects too (ex -if its a car race- you need to look at road, people, other objects like buildings etc)
Performance Check the loading time of a game
Make sure that any action is not taking considerable time, game flow should be fast
Score score calculation
Verify leaderboards General/All time/Weekly/local etc
Check the score registration functionality
Check the format (whether, comma is required in score etc ideally if customer is a foriegner coma should be in millions not in thousands )
Check for level completion syncs with the score
Time Out Check for time out
Do the actions when time-out yet to happen
Multitasking Switch b/w different apps and play game , check for sound, score, UI, time-out etc
Pause Check if game is paused when call received or multitasking or sleep mode
Save Settings Turnoff and ON device, check if settings are saved
Log out /On , check same
User should not loose his game in above conditions
User profile Put a all types of images in Player profile and check
Put special character, numbers,space in username and check
Password should be in masked
Chat feature Check the profile images
max limit of chat description
Enter empty string, special character and check
For a opponent , there should be a notification that he has received a message
Functionality Check game area, game logic
play till last level
get the cheat codes from development team and check all the levels
Check for the features that will be unlocked level-wise
Check for bonus score
Check the score hike when level gets increased
Check for multi-tap action (example in a car race we hold accelerator and left/right turn button simultaneously)
Menu options
Different game modes/location
Help & About Screen Should be in easily understandable format
free from spelling mistakes
URL should be hyperlinked (depends)
Multiplayer game Session expiry check
login/log out
Registration (Sign Up)
Verify account (receive verification mail)
login with registered but not verified account (without clicking verification link)
Forgot password checks (many cases here)
Game flow
Check for WIN/lost/Draw
Check user statistics graph
Challenge/Decline challenge/receive challenge
Check for forfeit
Check when player 2’s turn is on Player 1 is not able to do actions (should not be able to forfeit also)
Check for pass turn
Check for time-out (for one player)
Check the score for both the players till game ends
Memory leak Check the game when device memory is low
Network (n/w) check N/w messages if n/w is not present
check if what happens when n/w not present and user plays a move (whether score submitted for that move etc)
Check for localization Should be Support of different languages
Check for time format Change the device time , format etc
Size User wont like if your game takes lot of device space, so keep one eye on game file size
Device , OS Check in supported screen sizes and os versions (basicaly depend upon Client requirement)
Depends on platform Sometime we need to check as per OS guidliness as well. For ex in Wp7 we need to check in 2 background (light/dark).
Check Share options Post score via mail/FB/Twitter
Check the posted/sent messages in FB/Twitter/Mail. Check links are hyperlinked and application icon is displayed in
the post (depends)
If twitter integration is a manual ( custom UI developed by developer), check what happens when u enter more than
140 chars (as twitter limit is 140)
Music playing during app
launche
If music player running and we start installing any game app, music player should pauses without prompting for the user permission.
Steps for checking this:
1. Play a music file.
2. Launch the application.
3. Verify that while the application loads, it does not pause, resume or stop the actively playing music.
Interuption If app(game) is in running mode, then Check the behaviour of interuption like like Bluetooth, Infra red and CALL/SMS/MMS.
Upgrade the game
/ Battery effect
Upgrade of Games to the latest version and while migration all data should persist [ score, user profile etc ]
What if Battery goes down/switched of the cell while playing, Wheter the score wil get saved?

Web Services – API Automation Tutorials

Web Services – API Automation Tutorials

Hello Guys,
~~I’m launching my first video web series on Web Services – API automation on Vimeo. These videos are totally based on API – WS automation using HTTP Client and Rest Assured with framework designing step by step.

~~Interested people can buy these video directly on Vimeo. You will get life time access on these videos and will get full access on all upcoming videos at free of cost. Here is the link:


Course Content: 1. Manual Testing of WebServices/API: Introduction of API and WebServices: What is API What is WebService What is Backend Architecture Rest vs SOAP APIs What is CRUD operation What are different HTTP Calls – GET/POST/PUT/Delete Different Live Projects Examples 2. Postman: Introduction How to call Rest API in Postman How to pass path parameter in Request How to pass query parameter in Request How to set Headers in Postman How to pass JSON/XML Payload How to check response status code How to check JSON/XML response message What is response header 3. Rest Client and Advance Rest Client: Introduction How to hit REST APIs in Rest Client Basic and Advanced Settings in Rest Client How to check APIs at the network layer using developer tools of browser: How to check Backend services – APIs running behind What is developer tool in Chrome How to check request/response of any API in Firefox/Chrome browsers 4. What are different HTTP Status Response Codes: 100 series 200 series 300 series 400 series 500 series 5. Automation Testing of Back End Services: Learn HTTP Client: All CRUD – GET/POST/PUT/Delete Calls How to send Request with Payloads What is JSON Payload How to validate JSON response using JSON Parsers Common Utilities 6. Learn Rest Assured API in Java: Introduction Rest Assured methods: GET/POST/PUT/Delete BDD Framework in Rest Assured 7. API functional Testing using Jmeter Tool (only functional part) 8. API functional Testing using SOAP UI Tool 9. Maven: Build Automation Tool 10. TestNG (TDD) Framework for API automation 11. Cucumber (BDD) Framework for API automation 12. How to run API automation using Jenkins – CI tool (Continuous Integration) 13. Interview Questions: How to crack Product Companies interviews 14. Life Time Free Access on all Videos/Recordings

https://vimeo.com/ondemand/webservicesapiautomation

Cheers! Naveen AutomationLabs

How Much Java you need to learn for a good Selenium Scripting ?

How Much Java you need to learn for a good Selenium Scripting ?



As far as Selenium is concerned we have our SeleniumHQ Site with frequently updated documentation we can go through that to get the selenium concepts much strong also there are many blogs on selenium wherein you can get to learn from the basics even this blog is one among that, when considering the Language based client drivers if you use Java then here are some Java topics that you need to know for a better understanding and good selenium scripting.
    OOP’s concept – Class, Objects Polymorphism, Inheritance and Encapsulation
    Java Programming essentials– Object Instances, method overloading/overriding concepts and packages
    Control Statements – While, do-While, Switch, If statements – This will help us in writing the scripts for a multiple scenario statements and decision making scenarios.
    Looping statements – This will help us in scenarios like, iterating through a large table to find a record that you want and Running the same test for multiple number of times.
    Arrays Concepts – This will help us in having some set of datas of same type in a static way.
    Threads and MultiThreading Concepts – This will help us in making run our scripts in different threads that will help us in achieving better performance.
    Java Collections Framework – ArrayLists and HashMaps – This will help us in maintaining a collection of data’s. Particularly useful for scenarios where you need to compare the data from Web app UI with the DB. [OR] From UI to another UI
    File Streams – This will be helpful in externalization of data through CSV, Excel or Java Properties file.
    The above mentioned topics in java is will make you a pretty good selenium coder :). I will try to cover all these concepts with some real time examples. Until then please go through the Java concepts, there are many java tutorials on my YouTube channel:
    Cheers!
    Naveen AutomationLabs

    Why world is moving towards open source automation tools


    Why world is moving towards open source automation tools

    Testunity
    • Cost effective but matured solution: As the market growth has pushed up the overall expense for testing tools,
    •  it is directing IT organizations towards less expensive open source testing tools which offer the same 
    • functionality. With low licensing costs and fairly minimal hardware requirements, organizations get 
    • the extra benefit of flexible pricing plans as per the use of specific cloud storage.
    • Flexibility as per business strategy: As the open source tool can be altered as per particular requirement 
    • it reduces dependencies, unlike traditional tools. For example in Jira, the tester may include specific java 
    • code for some test scenarios. This promotes faster time around time of testing and resulting quick promote 
    • of the deliverables.
    • Open source community support and collaboration: It is easier to seek guidance and help from open
    •  source community. It is a centralized collaboration across the globe with the specific strategy and attention
    •  to contribute to the community.
    • Fast and frequent testing: As the automated test cases are short, those run faster and frequently as 
    • programmed by the testers. Hence, it is a very effective solution to find the bugs when you are testing 
    • your software in an agile environment with changing requirements. You can continuously add new test cases 
    • over the time to existing automation while development is on the go.
    • The paradigm shift: The software industry is facing the continuous threat of recession which ultimately 
    • has tightened the organizational budget. As open source tools are easy to learn and even a programmer 
    • can also work as a tester, organizations are stressing on their existing resources to learn it rather than 
    • hiring traditional testers.
    • Enable Agile testing: The traditional model of testing lifecycle follows “V” model. However, organizations 
    • now have recognized promising success by using open source tools in the Agile development environment. 
    • These tools significantly help in enabling early unit tests and also integration mechanisms which are very 
    • effective for time-sensitive Agile projects.
    • Freedom with greater security: Using open source automation tools frees organizations from vendor-specific 
    • restrictions like their availability for support, usage rules and much more. With open source tools, 
    • the user can make the decisions themselves and have the freedom to enhance the overall execution 
    • speed of the testing process. Also, in terms of security, open-source software is definitely superior to 
    • traditional frameworks.
    • Leverage cross platform and cross language testing: One of the major criteria of your testing tool 
    • must be its cross-platform and cross-browser support as  today’s applications are mostly run on mobile 
    • devices. Open source tools like Selenium, Appeium supports these features covering any kind of mobile 
    • app whether it is native, web-based or hybrid.





    In today’s fast-moving demanding world, it is a challenge for any software company to sustain 
    at the same performance level with constant quality and efficiency. The major challenges here 
    are time and cost and of course market competitors. Hence to sustain your business, whether 
    it is a product or service, quality delivery with optimized cost is the only solution. Otherwise,
     it leads you to customer dissatisfaction, and ultimately you will end up with bad market 
    reputation. And when you are in the software business, testing is the key to assure the quality.

    Over the past decade, the software industry has witnessed the revolutionary change in 
    the software testing and QA domain with the boom of automation testing. As the automation 
    testing has the ability to hit the core bottleneck areas of traditional manual testing, like poor
    test strategy, delay in testing, enhanced cost due to wrong effort estimation etc, companies are 
    leaning towards it. Moreover, with the upcoming open source automation tools like Selenium, 
    Appium, JUnit and much more, the trend is following this path with a rapid pace. 
    Even most of the renowned software companies are enforcing their employees to learn these tools.

    A number of industry-standard open source automation testing tools is now available 
    to fit with different stages of the testing process, from unit testing to complex user testing. 
    Open source tools have become an integral part of the IT spectrum in nearly every area of 
    software testing domain. Here is a bar chart for a rough overview of these tools in terms of 
    trending popularity across the globe –
    Mostly used open-source automation tool

    Mostly used open-source automation tool
    Advantages those drive business to select Open Source Automation tools 
    A real-time case study of an entertainment site by a market leading software company shows 
    how open source testing accelerated testing:
    Real-time example of automation

    Real-time example of automation
    Conclusion
    Although open source tools can drive significant quality and predictability in the testing life cycle,
    proper approaches must be taken care before using it. Every app is different, hence proper feasibility 
    study and pilot implementation are required before stepping into a live experiment. In some cases, 
    open source and commercial testing tools are blended together to get the overall better outcome and testing reliability.

    Locator Strategies in Selenium WebDriver

    Locator Strategies in Selenium WebDriver

    Introduction

    Now a days Selenium is vastly used as web automation tool across industry. It has its own advantages whether it might be an open source tool or freedom of scripting language. Selenium WebDriver mimics the actual user operations, so it gives the actual user experience while execution.
    Selenium have wide range of locators which helps to locate elements on a web page.
    Today we will talk about them.

    Selenium Locators

    Selenium gives user options to locate elements in 9 different ways.
    • Id
    • Name
    • Linktext
    • Partial Linktext
    • Tag Name
    • Class Name
    • CSS (Cascaded Spread Sheets)
    • XPath (XML path)
    • DOM (Data object modeling) (Not supported by WebDriver)
    The sequence of the operator shows how much your script is going to be efficient while execution. To elaborate this lets take one example.
    We will try to locate field User ID by Id and XPath.
    5
    Locator by id : Id= txtUserName Locator by xpath : XPath= //input[@id=’txtUserName’]
    (xpath might have different combination we will see them in xpath section.)
    If we execute script using both locators, to locate the field using Id will take less time compared to Xpath. In this way we will able to increase the efficiency of script by reducing execution time.
    Now we will see all locators in detail.

    Selenium Locators: Locate element by Id

    The most preferred, the easiest and efficient way to locate an element on a web page is By ID. Id will the attribute on the page which will be unique like you bank account number or employee id. Ids are the safest and fastest locator option and should always be the first choice even when there are multiple choices.
     Example 1:  <input id="txtUserName" type="text">
     Example 2:  <input id="txtUserName" name="userName" type="text">
    In first example its straight forward we only have Id, but in second we have Id as well as Name as an attribute. We can write the script as
     WebElement Ele = driver.findElement(By.id("txtUserName "));
    But in many cases we found that we have common Id or dynamic Ids (like in case of google, Gmail or the application using GWT). In that case we need to use different locators.

    Selenium Locators: Locate element by Name

    This is a fall back option when Id for element is not present. But mostly the names are used again and again, so make sure that the name is unique on the page before using it.
    Example:
    <input id="txtUserName" name="userName" type="text">
    WebElement ele= driver.findElement(By.name("userName "));

    Selenium Locators: Locate element by LinkText

    Finding an element with link text is very simple. This locator is used in case you want to locate any hyperlink only. But make sure, there is only one unique link on the web page. If there are multiple links with the same link, in such cases Selenium will perform action on the first matching element with link on page.
    Example:
    2
    In above image we have three hyperlinks. If we want to locate the Forgot Password? Link. The locator will be
    <a href="#">Forgot Password? </a>
    WebElement hyperlink = driver.findElement(By.linkText("Forgot Password?"));
    We have 2 links with text Forgot Email. If we try to locate 2nd link with locator
    LinkText=*Forgot Email. Selenium will locate 1st link.
    3
    In this case if we want to locate the 2nd link, we will need to use exact keyword with colon (exact:). The locator in that case will be
    linkText= exact:*Forgot Email
    <a style="background-color: transparent;" href="#">*Forgot Email</a>
    WebElement hyperlink = driver.findElement(By.linkText("exact:*Forgot Email"));
    4

    Selenium Locators: Locate element by Partial LinkText

    Partial LinkText works same as LinkText, only difference is you can use a part of the text from link.
    Example:
    <a href="#">Forgot Password? </a>
    WebElement hyperlink = driver.findElement(By. PartialLinkText ("Password"));

    Selenium Locators: Locate element by Tag Name

    Tag Name we can use for the elements like drop downs, check boxed, radio buttons. Following html is for drop down with 3 values. To select that drop down we will use tagName locator.
    Example:
    <select name="selCity" id="selCity">
    <option value="none">--Select--</option>
    <option value="PUNE">Pune</option>
    <option value="ADI">Ahmedabad</option>
    </select>
    WebDriver command:
    Select select = new Select(driver.findElement(By.tagName("select")));
    select.selectByVisibleText("Pune");
    or
    select.selectByValue("PUNE");

    Selenium Locators: Locate element by Class Name

    This locator we can use as a fall back option for either name or Id. But the same condition applied here Class name should be unique or selenium will locate the first element present on the page with the class name we have used to locate element.
    Example:
    <input id="txtName" class="textboxcss" tabindex="1" type="text">
    WebElement classtest =driver.findElement(By.className(“textboxcss”));

    Selenium Locators: Locate element by CSS selector using html tag attributes

    This a fall back when all options fail, you can use parent child relation in tags, in case you need to use complex strategy to locate elements. CSS selectors are string representation of HTML tags, attributes, Id, Class. It’s somewhat complex strategy compared to the previous we seen. But we can locate the elements which don’t have even Id or name or class using CSS selectors.
    We can use different combinations of attributes to locate an element using CSS selector.
    • Tag and ID
    • Tag and class
    • Tag and attribute
    • Tag, Id and attribute
    • Tag, class, and attribute
    • nth-child()
    • Inner text (Not supported by WebDriver)
    These are commonly used combinations, for more combinations you can refer this
    URL: http://www.w3schools.com/cssref/css_selectors.asp
    But you need to check first that the combination you are going to use is supported by Selenium WebDriver.

    Tag and ID

    In this case you need to follow this syntax css=tag#id. For Id we need to use sign before id value.
    Example:
    <input id="txtName" class="textboxcss" tabindex="1" type="text">
    css=input#txtName
    WebElement cssele = driver.findElements(By.cssSelector("input#txtName"));
    Here input is tag name and Id is txtName with # sign.

    Tag and Class

    In this case you need to follow this syntax css=tag.classname. For class we need to use dotbefore class value. If there is space between classname like classname you need to use dot in between space.
    Example 1:
    <input id="txtName" class="textboxcss" tabindex="1" type="text">
    css=input.textboxcss
    WebElement cssele = driver.findElements(By.cssSelector("input.textboxcss"));
    Example 2:
    <input id="txtName" class="textboxcss top" tabindex="1" type="text">
    css=input.textboxcss.top
    WebElement cssele = driver.findElements(By.cssSelector("input.textboxcss.top"));
    Here input is tag name followed by dot and class name textboxcss. In example 2 class name is
    textboxcss<space>top in that case we put dot in between textboxcss and top.

    Tag and Attribute

    In this case when we don’t have both Id or class name we go for html attributes given in tags.
    Syntax for this combination is css=tag[attribute=’value’]. We need to use square brackets to specify the attribute and its value. Put the value between single quotes when you are writing script in Java.
    Example:
    <input value="Reading" type="checkbox">
     css=input[type=’checkbox’]
    or
     css=input[value=’Reading’]
    Here in first case type is attribute and checkbox is its value, in other case value is an attribute and its value is Reading.

    Tag, ID and Attribute

    In this case when we have common id but other attributes are different, we go with this combination. Syntax for this combination is css=tag#id[attribute=’value’].
    Example:
    <input id="txtName" class="textboxcss" tabindex="1" name="taComment" type="text">
    <input id="txtName" class="textboxcss" tabindex="1" name="tbComment" type="text">
    css=input#txtName[name=’taComment’]
    WebElement cssele = driver.findElements(By.cssSelector("input#txtName[name=’taComment’]"));
    Here for both textboxes id is same ever class name is also same, only name is different for both. So if we want to locate first text box we will go with locator given in above example. For second text box we need to change value of name attribute in same combination.

    Tag, Class and Attribute

    In this case when we have id but we have class name which is common around other elements but other attributes are different, we go with this combination. Syntax for this combination is css=tag.classname[attribute=’value’].
    Example:
    <input class="textboxcss" tabindex="1" name="taComment" type="text">
    <input class="textboxcss" tabindex="1" name="tbComment" type="text">
    css=input.textboxcss [name=’taComment’]
    WebElement cssele = driver.findElements(By.cssSelector("input.textboxcss [name=’taComment’]"));

    nth-chilld()

    In this case we have same Id or class name and other attributes for different elements, we can go with nth-child().
    Syntax for this combination is css=tag:nth-child(n). Here in syntax we can use any combination discussed above. With that we need to use: nth-child(n). n represent child number.
    Example:
    <ul>
    <li>C</li>
    <li>C++</li>
    <li>C#</li>
    <li>Java</li>
    <li>Python</li>
    <li>Ruby</li>
    </ul>
     css= li:nth-child(n)
    WebElement cssele = driver.findElements(By.cssSelector("li:nth-child(n)"));
    Here if we can see the ul li parent child structure. We have only tag names which are common to everyone. Here if we want to locate sat Java we will put n=4 in above command.
    6

    Inner text

    This is right now not supported by WebDriver in case of CSS, but most probably will support in upcoming Selenium 3 or 4.
    Syntax: css= tag:contains(‘inner text’), Here in syntax we can use any combination discussed above. With that we need to use (:) contains(inner text).
    Example:
    <span>Upload you pic :</span>
      css= span:contains(‘Upload you pic ‘)
    WebElement cssele = driver.findElements(By.cssSelector("span:contains(‘Upload you pic‘)"));

    Absolute and Relative Path

    The Examples we have seen till now are related to only single tag and its attribute. But when we require to build path using parent child relation we need to give its either absolute or relative path.
    Example:
    <div>
    <ul>
    <li>C</li>
    <li>C++</li>
    <li>Python</li>
    </ul>
    </div>
    Consider here we want to locate Python using parent child relation. In that case relative path will be
    Relative path: css=div<space>ul<space>li:nth-child(3) or css=div<space>li:nth-child(3). In second combination we have removed ul. Space denotes it’s a Relative path. Here WebDriver will search 3rd li inside given div and ul.
    And if we want Absolute path for same, it will be
    Absolute path: css= div>ul >li:nth-child(3) or css=ul> li:nth-child(3). Here angular bracket denotes Absolute path. It’s an exact path for given element.
    To know the difference between both let’s consider the example.
    Someone asked you where is your office? Most common answer is Hinjewadi. But if a courier boy asked you the address you will tell full and exact address of your office. 1st one is relative path to your office but 2nd is absolute one.

    Security Testing Test Scenarios – By Naveen AutomationLabs

    Security Testing Test Scenarios – By Naveen AutomationLabs



    1. Check for SQL injection attacks

    2. Secure pages should use HTTPS protocol

    3. Page crash should not reveal application or server info. Error page should be displayed for this

    4. Escape special characters in input

    5. Error messages should not reveal any sensitive information

    6. All credentials should be transferred over an encrypted channel

    7. Test password security and password policy enforcement

    8. Check application logout functionality

    9. Check for Brute Force Attacks

    10. Cookie information should be stored in encrypted format only

    11. Check session cookie duration and session termination after timeout or logout

    11. Session tokens should be transmitted over secured channel

    13. Password should not be stored in cookies

    14. Test for Denial of Service attacks

    15. Test for memory leakage

    16. Test unauthorised application access by manipulating variable values in browser address bar

    17. Test file extension handing so that exe files are not uploaded and executed on server

    18. Sensitive fields like passwords and credit card information should not have auto complete 
    enabled

    19. File upload functionality should use file type restrictions and also anti-virus for scanning uploaded files

    20. Check if directory listing is prohibited

    21. Password and other sensitive fields should be masked while typing

    22. Check if forgot password functionality is secured with features like temporary password expiry after specified hours and security question is asked before changing or requesting new password

    23. Verify CAPTCHA functionality

    24. Check if important events are logged in log files

    25. Check if access privileges are implemented correctly



    ~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

    Follow me on my Facebook Page:

    Let’s join our Automation community for some amazing knowledge sharing and group discussion:
    « Older posts Newer posts »