Monday, July 29, 2019

Question: How do you check whether a table data(values) is sorted or not? Sorting happens when clicking on Table Header(Ex: Name, which is a link).
Name
Venu
Avinash
Dharma
Answer:
We can take an array of String type as expected values and consider the column values which need to be verify are as actual values. Which can be resolved by below example.


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CompareTwoLists {
       public static void main(String[] ar){
              List<String> expdValues = new ArrayList<String>();
              expdValues.add("venu");
              expdValues.add("avinash");
              expdValues.add("dharma");
              Collections.sort(expdValues);     //to arrange given list in sorting
             
              List<String> actValues = new ArrayList<String>();
              actValues.add("dharma");
              actValues.add("venu");
              expdValues.add("avinash");
              Collections.sort(actValues);
             
              if(expdValues.equals(actValues)){
                     System.out.println("Given Lists are Matched");
              }else{
                     System.out.println("Given lists are not matched");
              }
       }
}



Related Posts:

  • Introduction to Software Testing What is Software Testing: Software Testing is a process of verifying or validating an application with the intention of finding bugs or defects. This can be done through either manually or using automation tool.… Read More
  • Can we store ArrayList's object of type String into ArrayList's reference of Object type? Why not List<String> listString = new ArrayList<String>();  You can assign an ArrayList<String> to a List<String> reference variable, but you can never assign an object with one generic type to a… Read More
  • Selenium Introduction What is Selenium: Selenium is an Automation Testing Framework which automates web applications for testing purposes. It is an open source and mainly used for automating functional tests and regression tests. Note: It can b… Read More
  • Difference between Selenium 1, Selenium 2 and Selenium 3 Selenium 1 = Selenium Remote Control Selenium 2 = Selenium Webdriver, which combines elements of Selenium 1 and Webdriver. Selenium 3 = Selenium  1 + Selenium 2 (RC is deprecated and moved to legacy package) … Read More
  • Introduction to Java What is java? Java is a programming language and a computing platform for application development. It was first released by Sun Microsystem in 1995 and later acquired by Oracle Corporation in 2010. In 2006 Sun started … Read More

0 comments:

Post a Comment

Selenium Training in Realtime

Blog helps to a student or IT employee to develop or improve skills in Software Testing.

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts