Learn Selenium and Java for Selenium

Sunday, 15 July 2018

WebServices Test Automation-Introduction


What is WebServices?
WebServices are set of rules and protocols which helps in communication between two software on same or different platforms. For implementing these webservices there are two popular approaches:

REST:
REST stands for REpresentational State Transfer. This requires less bandwidth than SOAP. It allows all types of data formats  like plain text, HTML, XML, JSON etc
For example:
http://services.groupkt.com/country/get/all

SOAP:
SOAP stands for Simple Object access protocol. This requires more bandwidth than REST. It allows XML data format only.

Web services component?
Before moving to webservices testing, we should know about web services components.So have look at webservices components.

URL – Web service URL. Using this URL, we can send multiple requests to server.
For example:
http://services.groupkt.com/country/get/all

HTTP Method – GET, POST, DELETE etc.
GET: This method will fetch data from database and display to user.
POST: This method will enter new entry into the database
Delete: This method will Delete record from database.
PUT: This method will update any record from database

Header –  This will define what type of data we are passing.

Body Parameter – Here we pass actual data along with the request.

Response Code – After request has completed we will get response. There are specific codes are defined according to type of request has been made.For example:200,500 etc

What is Web Services testing?
Webservices can be tested by manually or by automation.First, We will see how to test  it manually. There are couple of tools are available for webservices testing.
SOAPUI, Postman etc.

You can download Postman from below :
https://www.getpostman.com/apps

You can install and open it.
PFB the sample screen shot for UI of Postman, where We need to hit the web services URL.I would be using above URL only.
Here, I am fetching data using GET method.





How can we Automate?
Manual testing for webservices is more tedious and time taking. There are couple of tools and frameworks are available for webservices  automation testing. SOAPUI, RestAssured, jersey-client, etc
In upcoming articles, we will see webservice automation testing using jersey-client.

Saturday, 14 July 2018

What are collections in JAVA?

What are Collections in JAVA?


Today we will be learning of Collections , Collections in java are used to store different object in a single unit.It is like a jar of chocolates


Now let us understand why we need Collections?


As java Collections framework provide useful set of classes and its methods which are very powerful. If we need to perform algorithm operation we can perform that, if we want to perform add,remove operation that are also easily achievable .

Collections framework helps to decrease the development effort and increase the quality of code

A Collections framework consist of

  •                    Interface and its implementation(classes)
  •                          Algorithms


Use of Collections

The use of Collections is not all about its powerful nature it is also about about the flexibility it adds , consider if we use array we define its fixed size but after using the arraylist in Collections the size is dynamic which helps not to waste any memory.Now Collections can also store both homogeneous and heterogeneous objects which is an additional advantage ,so benefits are many


In next article we would understand the Collections architecture, Keep reading!!


Sunday, 8 July 2018

Strings in Java : Part 7

String Methods

Remember our last post focused on usage of split() method in string in case you have missed seeing that you can see our Strings in Java : Part 6 Post , now we are going to explain some of the easy and most commonly used string methods here ,

  • String toLowerCase()
    • This method converts all the character in string to the lower case
  • String toUpper()
    • This method converts all the character in string to the upper case
  • String concat()
    • This method is used to combine two strings
  • String replace()
    • This method is used to replace a old character with new character
  • String compareTo()
    • This method is used to compare given string to current string and this method can return positive, negative or zero values


Let us understand the usage of methods used above using below program :


public class Main{  
public static void main(String args[]){  

String s1="Learn Selenium Automation";
String s2="Selenium ";

String lower = s1.toLowerCase(s1);
String upper =s1.toUpper(s1);
String replace =s1.replace('L', 'T');
String concat=s1.concat("Easily");

System.out.println(s1.compareTo(s2));
System.out.println(upper);
System.out.println(lower);
System.out.println(replace);
System.out.println(concat);

 }
}  

The output of the above program is 

-6
LEARN SELENIUM AUTOMATION
learnseleniumautomation
Tearn Selenium Automation
Learn Selenium Automation Easily


Hope you have understood the Post if there is any doubt please feel free to add the comments section we would answer your queries :)

Saturday, 7 July 2018

Strings in Java : Part 6

String Methods

Exited about the next method that we are going to explain is Split() method in string. It is commonly asked method in the interviews and it is used most frequently in the Automation projects.

Split() method in short returns the array of the string based on the delimiter provided in the method.

So let us understand the basic syntax and usage of the split method


  • String split()
    • The split() method split the string into the arrays of sub string based on the separator specified
  • split() method is available with 2 different variables which are
    • String array[]= str.split("/")- It will return the array of strings whenever a '/' is encountered in string. 
    • String array[]= str.split("/,2")- It will return array of only 2 strings even after the '/' is present in string more than 2 times.


Let us understand the split() method using the programs



public class Main{  
public static void main(String args[]){  

String s="Learn/Selenium/Automation";  

   String[] a=s.split("/");//   

      System.out.println(a[0]);
      System.out.println(a[1]);
      System.out.println(a[2]);
  
 }
}  

The output of the above program is 

Learn
Selenium
Automation

                    Now Lets try the other variant of the split() method

public class Main{  
public static void main(String args[]){  

String s="Learn/Selenium/Automation/Strings";  

   String[] a=s.split("/,2");//   

      System.out.println(a[0]);
      System.out.println(a[1]);
 
  
 }
}  

The output of the above program is 

Learn
Selenium/Automation/String


Hope you have understood the Post if there is any doubt please feel free to add the comments section we would answer your queries :)

Popular Posts

Recent Posts



Newsletter

Join our newsletter to get secret tips directly in your inbox!


*We Hate Spam!

Powered by Blogger.