Pages

Thursday, 26 March 2020

Top 10 Interview Questions on Array for Fresher-SDET-Automation Testing 2020?


Top Interview question on Automation testing- Selenium:
  •  How to declare an array?
         int tests[];

  • How to create an array?
         tests= new int[5];

  • How to declare 2d array?
        int[][] matrix;

  • How to create 2d array?
        int[][] matrix = { { 1, 2, 3 }, { 4, 5, 6 } };

  • How to Assign values to array
        tests[0] = 25;
        tests[1] = 30;
        tests[2] = 50;
        tests[3] = 10;
        tests[4] = 5;

  • How to  Declare, Create and Initialize Array on same line
        int tests[] = { 25, 30, 50, 10, 5 };

  • How to loop around an array - Enhanced for loop
   
 for (int mark : marks) {
            System.out.println(mark);
        }


  • How to get Length of an array : Property length
        int length = tests.length; 

  • How to do Sorting An Array?
        int rollnumbers[] = { 12, 5, 7, 9 };

        Arrays.sort(rollnumbers);


  • How to create String Array?
        String[] daysWeek = { "Sunday", "Monday", "Tuesday", "Wednesday",
                "Thursday", "Friday", "Saturday" };


Check below link on top Interview preparation:

SQL Query   Cucumber-BDD    Linux Commands    Maven   GIT   TestNG@after@before
 

*************************************************

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
 

Friday, 13 March 2020

How to create repository in bitbucket and push code for automation project?


Below are the sequence of commands to use:

  • First go to your bitbucket path and get access to create repository.
  • Create a repository with a self defined name, let name is "Automaters"
  • Then open cmd in the laptop where you have kept your automation project

  • cd existing-project
  • git init
  • git add --all
  • git commit -m "InitialCommit"
  • git remote add origin "https://path....Automaters.git"
  • git push -u origin master


If you get SSL certificate error to push then use below:

Monday, 9 March 2020

Top asked advanced TestNG annotations: Set-1 for SDET/Automation Testing/Developers?




Must know TestNG annotations for Experienced Automation Testers
  • alwaysRun 
If set to true, this test method will always be run even if it depends on a method that failed.

  • dependsOnMethods
The list of methods this method depends on.

  • @test:
Marks a class or a method as part of the test.

Example:
@Test
public void methodone() {

           System.out.println("Methodone");

           // Failing test explicitly

           Assert.fail();

      }

      // alwaysRun attribute will override dependsOnMethods if dependent method is failed or skipped

      @Test(dependsOnMethods = "methodone", alwaysRun=true)

      public void methodtwo() {

           System.out.println("Method two");

      }




















  • Description:    
The description for this method. It is important to give a small information about the test case.


  • Enabled:
Whether methods on this class/method are enabled.
When executing TestNG tests, there are scenarios where you have to disable a particular test or a set of tests from getting executed. For example, where a serious bug exists in a feature due to certain tests belonging to certain scenarios that cannot be executed. As the issue has already been identified we may need to disable the test scenarios from being executed.
Disabling a test in TestNG can be done by setting the enable attribute of the @Test annotation to false. This will disable the test method from being executed as part of the test suite.
Note: If this attribute is set for the Test annotation at class level, all the public methods inside the class will be disabled.

Example:

@Test( description = "Verify Login with valid credentials", enabled=false )
Public void login(){}


  • invocationCount 
The number of times this method should get invoked.

  • threadPoolSize  
The size of the thread pool for this method. The method will be invoked from multiple threads as specified by invocationCount.

Note: this attribute is ignored if invocationCount is not specified

  • timeOut   
The maximum number of milliseconds this test should take.

Earlier we discussed how to run classes, methods, and tests in parallel or in multi-threaded mode. TestNG also provides the flexibility to configure a test method to be run in a multi-threaded environment. This is achieved by configuring it while using the @Test annotation on a method.
AutoTest.java
public class AutoTest
{
    @Test(threadPoolSize = 3, invocationCount = 6, timeOut = 1000)
    public void testMethod()
    {
        Long id = Thread.currentThread().getId();
        System.out.println("Test method executing on thread with id as: " + id);
    }
}
The method is configured to run in multi-threaded mode by using the threadPoolSize attribute along with the Test annotation. The value of the threadPoolSize is set to 3; this configures the test method to be run in three different threads.
The other two attributes, invocationCount and timeOut, configures the test to be invoked a multiple number of times and fail if the execution takes more time.

  •  expectedExceptions      
The list of exceptions that a test method is expected to throw. If no exception or a different than one on this list is thrown, this test will be marked a failure.

public class ExceptionTesting {


    @Test(expected = ArithmeticException.class)
    public void testWithException() {
        int i = 1 / 0;
    }

 


Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

TRANING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122

Entire course content can be found below:  COURSE CONTENTCheck below link for question and answers with code:

Check below for TestNG annotations on @After and @Before:

TestNG@after@before 

Check below link on top Interview preparation:

SQL Query   Cucumber-BDD    Linux Commands    Maven   GIT