All About Testing All About Testing

What is the recipe for successful achievement?

To my mind there are just four essential ingredients: Choose a career you love, give it the best there is in you, seize your opportunities, and be a member of the team.

“All our dreams can come true, if we have the courage to pursue them.”

“I’m a great believer in luck, and I find the harder I work, the more I have of it.”

Success unshared is failure.

To make our way, we must have firm resolve, persistence, tenacity. We must gear ourselves to work hard all the way. We can never let up.

"Everyone you will ever meet knows something you don't."

he fact that I can plant a seed and it becomes a flower, share a bit of knowledge and it becomes another's, smile at someone and receive a smile in return, are to me continual spiritual exercises.

The secret of success is to do the common things uncommonly well.

Good things come to people who wait, but better things come to those who go out and get them.

Sunday, 29 July 2018

API Testing Interview Questions And Answers


1.   While using the API tool, after entering the URL in the field, what response will happen in the backend.?
Ans - HTTPRequest with header and body is created

2.  What request will be served by the web service and what will be the request by the server to the browser.?
Ans -HttpRequest and HttpResponse

3.  In API testing, where we use POST and GET methods?
Ans - 
Post - sending data / uploading file
Get - requesting for data

4.  While testing the Registration Page and Login page in API, which comes under POST and GET methods?.
Ans -
Open login page - GET
Submit login id and password - POST
Open reg page - GET
Submit reg form - POST

Tuesday, 3 July 2018

TestNG Interview Questions with Answers

TestNG is the most widely used testing framework in the software industry.  It provides a lot of features over the conventional JUnit framework and is used for different kinds of testing like unit, functional, integration testing etc. 

Question 1: How TestNg is better Junit?

Answer :
          1.TestNG have advance annotations and more annotations then Junit 
          2. Execution pattern can be set in TestNG 
          3. We can concurrently execution our test scripts. 
          4. Test case dependencies can be set in TestNG 
          5.The data-driven framework can be easily implemented using Data Provider. 
          6.TestNG can generate the report in a readable format. 
          7.Grouping of test methods 
  8.Multithreaded execution

Question 2: What is NG stands for in TestNG?

Answer :
NG stands for "next generation" in TestNG.

Question 3 : How suites and tests are configured in TestNG?

Answer :
Suites and tests are configured through XML 
files. By default, the name of the file is testng.xml

Question 4: Why TestNG XML files are used?

Answer :
It allows to include (or exclude) respective packages, classes, and methods in their test suite, used to pass parameters to test methods ,It also allows users to group test methods.

Question 5 : Write an TestNG xml code to execute a particular class.

Answer :
<suite name="First Suite" verbose="1"> 
<test name="First Test" >
<classes>
<class name="test.FirstTest" />
</classes>
</test>
</suite>

Question 6 : How to execute TestNG xml using command line?

Answer :
java -cp "/opt/testng-6.8.jar:bin" org.testng.TestNG testng.xml 

//Write above code in command line 
//-cp option of Java to compiled code 
//org.testng.TestNG consists of the main method 
///opt/testng-6.8.jar is the path to the testng JAR

Question 7 : After execution an HTML report is generated by TestNG in which folder?

Answer :
After execution an HTML report is generated by TestNG in a folder named "test-output".

Question 8: How to execute testng.xml using Eclipse

Answer :
1. Open Eclipse and go to the project where we have created the testng.xml file. 
2. Select the testng.xml file, right-click on it, and select Run As | TestNG suite. 
3. Eclipse will execute the XML file as TestNG suite.

Question 9: Tell Before and After annotations in testNG

Answer :
1.@BeforeSuite/@AfterSuite 
2.@BeforeTest/@AfterTest 
3.@BeforeGroups/@AfterGroups 
4.@BeforeClass/@AfterClass 
5.@BeforeMethod/@AfterMethod

Question 10: Give the name of the attribute which provides method dependency

Answer :
"dependsOnMethods" attribute provides method dependency

Question 11: Give the name of the attribute which provides Groups dependency

Answer :
"dependsOnGroups" attribute provides method dependency

Question 12: What will happen if any method under @Test annotations is set private?

Answer :
If a class is annotated by the Test annotation, TestNG will consider only the methods with public access modifiers as test methods. All the methods with other access modifiers will be neglected by TestNG.

Question 13 : How to disable a test method?

Answer :
Disabling a test can be achieved in TestNG by setting the enable attribute of the Test 
annotation to false 
@Test(enabled=false) 
public void testMethodOne(){ 
System.out.println("Test method one."); 
}

Question 14 : How to set time test at suite level?

Answer :
Add a testng.xml file to the project and put the following code to it: 
<suite name="Time test Suite" time-out="500" verbose="1">
<test name="Timed Test">
<classes>
<class name="test.timetest.TimeSuite" />
</classes>
</test>
</suite>

Question 15: How to set time test at test method level?

Answer :
@Test(timeOut=500) 
public void timeTestOne() throws InterruptedException{ 
Thread.sleep(1000); 
System.out.println("Time test method one"); 
}

Question 16 : How will you create a test that belongs to a group?

Answer :
Test that belong to a group 
public class TestGroup { 
@Test(groups={"test-group"}) 
public void testMethodOne(){ 
System.out.println("Test method one belonging to group."); 
}

Question 17 : List Out Common Testng Assertions?

Answer :
Common Testng Assertions : 
1.assertEqual(String actual,String expected) 
2.assertEqual(String actual,String expected, String message) 
3.assertEquals(boolean actual,boolean expected) 
4.assertTrue(condition) 
5.assertTrue(condition, message) 
6.assertFalse(condition) 
7.assertFalse(condition, message)

Question 18 : What Is Soft Assert In TestNG?

Answer :
Soft Assert collects errors during @Test. Soft Assert does not throw an exception when an assert fails and would continue with execution.

Question 19: What Is Hard Assert In Testng?

Answer :
Hard Assert throws an AssertException immediately when an assert statement fails and test suite continues with execution.

Question 20 : How To Set Test Case Priority In Testng?

Answer :
Setting Test Case Priority In Testng 
'@Test(priority=0) 
public void testCase1() { 
//line of code 
@Test(priority=1) 
public void testCase2() { 
//line of code 
}

Question 21 : How To Exclude A Particular Test Method From A Test Case Execution?

Answer :
Excluding a Particular Test Method From Test Case Execution 
<classes>
<class name="TestCaseName">
<methods>
<exclude name="TestMethodNameToExclude"/>//using exclude tag 
</methods>
</class>
</classes>

Question 22 : create a test having multiple groups

Answer :
Test having multiple groups 
@Test(groups={"group-one","group-two"}) //Two groups are defined here 
public void testMethodTwo(){ 
System.out.println("Test method two belonging to both 
group."); 
}

Question 23 : Write TestNG.xml code to run a group of test cases using group attribute of testng

Answer :
<suite name="Multi Group Suite" verbose="1">
<test name="Group Test one">
<groups>
<run>
<include name="group-one" />
</run>
</groups>
<classes>
<class name="test.groups.MultiGroup" />
</classed>
</test>
</suit>

Question 24 : List out various ways in which TestNG can be run?

Answer :
TestNG can be run with 
1.Eclipse IDE 
2.ant build tool 
3.command line 
4.IntelliJ’s IDEA

Question 25 : Explain how will you define dependencies in TestNG ?

Answer :
defining dependencies in TestNG 
1.dependsOnMethods in @Test annotations 
2.dependsOnGroups in @Test annotations

Question 26 : What are the Different build tools available?

Answer :
Different build tools available are 
1.Ant 
2.Maven 
3.Gradle

Question 27 : How to pass a parameter with a testng.xml file to use It In test case?

Answer :
  <parameter name="browser" value="FFX" /> //Parameter Tag you will write in TestNG.xml 
@Parameters ({"browser"}) //Parameters annotation you will define belwo @Test Annotation

Question 28 : Arrange testng.xml tags from parent to child.

Answer :
<suit> 
<test>
<classes>
<class>
<methods>

Question 29 : What are the two main ways to generate a report with TestNG?

Answer :
1.Listeners: For implementing a listener class, the class has to implement the org.testng.ITestListener interface. These classes are notified at runtime by TestNG when the test starts, finishes, fails, skips, or passes. 

2.Reporters: For implementing a reporting class, the class has to implement an org.testng.IReporter interface. These classes are called when the whole suite run ends. The object containing the information of the whole test run is passed to this class when called.

Question 30 : What is TestNG Reporting Support?

Answer :
TestNG generates test reports in HTML and XML formats. WebDriver does not have any native mechanism for generating reports.
TestNG window is more useful than console window in Eclipse as it generates text-based result while TestNG window generates a graphical output of the test result. 
It gives the Runtimes of each and every method and also the order in which methods are executed.

Expansion Pune Aundh Interview Questions Automation

*Expansion Pune Aundh*
Interview Questions Automation
Dated: 10 march 2018

1. What is the Explicit wait and Implicit wait?

2. What is a headless browser?

3. How to get a screenshot in Selenium? Can you write the syntax?

4. What are the different type of Locators in Selenium?

5. What is the best way to locate a web element if there is no unique XPath?

6. What is StaleElementReference Exception? Have you encountered it ever and how you handled it?

7. Do you run test cases in parallel with TestNG? If yes how many threads and does it cause any problem?

8. What is the most common locator you use in your project?

9. Have you ever done profiling of a web page?

10.How frequently you use Thread.Sleep()?

11. Suppose there are two elements on a web page with same ids, how will you handle it?

12. Can we create an object for an interface?

13.Difference between @BeforeTest and @BeforeMethod in TestNG?

14. How does Selenium interact with the Web browser?

15. Can you make the constructor of a class static?

16. How do you maintain your test scripts and how frequently you have to modify them?

17. How to find all broken links on a webpage?

18. Explain your Automation Framework.

19. Write a dynamic XPath to locate a table's 2nd row 3rd column data.

20.Hashmap vs Hashtable.

21. What is the significance of hash table?

22. What is the return type of findElements?

23. What’s the difference between a Maven project and a Java project?

24.Getwindowhandle vs Getwindowhandles and the return types.

25.Comparable vs comparator.

26. Explain about the Project along with how the Automation was done.

27. How to upload a file in Selenium?

28. How to upload a file without using Sendkeys?

29. How to connect to a Database using Selenium?

30.Any idea or experience with Continous Integration tool?

31. How to handle a drop-down in Selenium?

32. What is WebDriver – interface?

33. Why do we need Interface in the test?

34. How to integrate your test with Jenkins?

35.Any example or practical usage of Runtime polymorphism?

36. How to find dynamic elements?

37. What is the difference between CSS selector and XPath? Which is better from a performance perspective?

38.Difference between Instantiate and Initialize in Java.

39. What is mean by fluent wait?

40. What kind of framework have you made?

41. What’s TestNG Listener Class & why do we use it?

42.Any idea about Selenium Grid? Or Parallel execution.

43. What are the challenges you face when running automation scripts?

44.Difference between == and =.

45. What’s Page Factory?

46. How to click a button without using click() and without using CSS & XPath selectors?

47. Are multiple inheritances possible in Java? Why?

48. Are all methods in an abstract class, abstract?

49. Can we make an Object of Abstract class or an Interface?

50. What’s the difference between method overloading and overriding?

51. What’s the use of Java Static keyword?

52.Different type of polymorphism.

53.Can we write webdriver dr = new webdriver();

54. What are the different plugins used for Maven? And it's used?

55.Difference between Abstract and Interface?

56. Try, Throw & Catch syntax. And why is it used?

57. How do you manage to re-run only failed test cases?

58. How to make TestNG.xml at run-time?

59. What’s Singleton class?

60. Can we have Finally block without Try & Catch blocks?

Wednesday, 2 May 2018

Honeywell Written Interview Question

Find the output of the following Programs:

1. public class Script1
   {
public static void main(Object[]args){
int result = add(1, 2);
System.out.println(result);
   }
   int add(int x, int y)
        {
   return x+y;
        }
double add(int x, int y)
{
  return x+y;
}
   }


2. public class Script2
   {
public static void main(Object[]args){
String str1 = "Hello";
String str2 = "Hello";
String str3 = new String("Hello"); //Using constructor

if(str1==str2)
   Sysout("Equal 1");
else
           Sysout("Not Equal 1");

if(str1 == str3)
   Sysout("Equal 2");
else
   Sysout("I am constructed using constructor")

if(str1.equals(str3))
          Sysout("Equal 3")
else
  Sysout("Not Equal 3")


3. interface IParent
   {
void printValue();
   }
   interface Iparent_New extends IParent
   {
void demoPrint();
   }
   public class DemoClass implements IParent_New
   {
public static void Main(String[]args)
{
  IParent_New parent_New=New DemoClass();
  parent.New.demoPrint():
}
public void demoPrint()
{
   Sysout("Inside demoPrint");
}
   }


4. try{
try{
res=num/0;
Sysout("The result is" +res);
   }
catch(ArithmeticException e)
{
Sysout("divided by zero");
throw new FileNotFoundException();
}
catch (FileNotFoundException e)
{
Sysout("File not found");
}}
catch(Exception e)
{
Sysout("Exception Found");
}


5. class Animal
{
String getColour()
{
return "Black";
}}
   class Dog extends Animal
{
String getColour()
{
return "White";
}
}
   public class Script2
{
public static void main(Object[]args)
{
Animal animal = new Dog();
Sysout(animal.getColour());
}
}


6. class Maps
{
public static void main(String[]args)
{
HashMap obj = new HashMap();
obj.put("A", new Integer(1));
obj.put("B", new Integer(2));
obj.put("C", new Integer(3));
System.out.println(obj);
}
}


7. Write a program to find wheather given no is Armstrong or not.
Example: Input - 153
Output - 1^3+5^3+3^3 = 153, so it is Armstrong no.

8. Write a program to Sort a given array without using library functions.
Array arr = {5,7,1,9,200,90,10,50,80}

9. Write a java program to count the number of words in a string.
String str = "You are given an array of numbers.Find out the array index or position.";

10. int count =0;
if(++count>0 && count++<2)
Sysout("Inside IF");
else
Sysout("Inside Else");

11. class evaluate{
public static void main(String[]args){
{
int arr[] = new int[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int n=6;
n = arr[arr[n] / 2];
Sysout(arr[n] / 2);
}}

Job | Opening for Manual and Automation Tester

Job opening for Software Tester (Experience in Manual and Automation both).
Experience required:4+ years
Location: Pune (Pimpri Chinchwad)
Notice Period: Immediate to 15 Days.

Job Description:
Experience in Manual and Automation Testing.
Experience designing test cases and execution strategies.
Experience testing web applications using multiple browsers/versions.
Reviewing and analyzing product requirements for clarity and consistency with existing features.
Providing test effort estimation based on the requirements.
Creating and executing test cases. Preparing reports.
Do documenting and verifying defects.
Finding clear reproduction steps for issues reported by other team members.
Verifying builds for quality before and after production deployment.
Software QA Blackbox experience.
Understanding of general QA methodology and planning.
Excellent at written and oral communication.
Methodical approach to solving problems.
Good understanding of web-based and mobile application s
Extreme attention to detail.
Design, write and execute detailed test cases across Android & iOS application.
Very good understanding of Mobile App Testing Processes and Concepts
Experience in the Automated testing of web-based software applications.(HTML, Java & JavaScript).
Experience with Selenium or similar automated testing framework.

Interested candidates can share the updated cv on soumya@ambab.com
with following details.
Relevant Exp:
Current CTC:
Expected CTC:
Notice Period:

Visit us at www.ambab.com