Java Selenium Cucumber Automation Testing

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is BDD?

(BDD) is a branch of Test Driven Development (TDD). BDD uses human-readable descriptions of software user requirements as the basis for software tests.

What are the JUnits annotations linked with Selenium?

@BeforeClass. @Before. @Test. @After.

What is a feature file?

A Feature File is an entry point to the Cucumber tests. This is a file where you will describe your tests in Descriptive language (Like English). It is an essential part of Cucumber, as it serves as an automation test script as well as live documents.

What are regular expressions? How you can use regular expressions in Selenium ?

A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings You can use regular expressions in locators to find elements such as driver.find_element_by_xpath("//input[contains(@name,'sel')]").

What is ATDD?

Acceptance Test Driven Development (ATDD) aims to help a project team flesh out user stories into detailed Acceptance Tests that, when executed, will confirm whether the intended functionality exists.

Cucumber

Cucumber is a testing tool that supports Behavior Driven Development (BDD) framework. It defines application behavior using simple English text, defined by a language called Gherkin

What is Page Object Model (POM)?

Design pattern used in Selenium to separate test code and page specific code such as locators.

Disadvantages of Selenium

Difficult to test image based applications Needs outside support for test generation activity reports like testng or jenkins Cannot test mobile applications Bad at handling pop ups limited reporting.

How to maximize a window/ get the size of a window?

Driver.manage().window.maximize() Window.getSize()

How will you find an element using Selenium?

Elements are found using locators. ID, Name, Linktext, Partial Linktext, Tag Name, Class Name, DOM Locator, CSS Selector, Xpath

What are the main advantages of using Test Automation?

Faster Feedback Cycle. Without test automation, feedback for newly developed features can take a while. Team Saves Time. Reduced Business Expenses.

What kind of testing is Selenium used for?

Functional testing and regression testing.

Functional testing vs non-functional testing?

Functional testing is a type of testing which verifies that each function of the software application operates in conformance with the requirement specification. his testing mainly involves black box testing Non-functional testing is a type of testing to check non-functional aspects (performance, usability, reliability, etc.) of a software application. It is explicitly designed to test the readiness of a system as per nonfunctional parameters which are never addressed by functional testing. A good example of non-functional test would be to check how many people can simultaneously login into a software

What Webdrivers are available for Selenium?

HTML Unit Driver Firefox Driver Chrome Driver IE Driver Opera Driver

What order should locators be used in?

ID, Name, Linktext, Partial Linktext, Tag Name, Class Name, DOM Locator, CSS Selector, Xpath

What is the difference between verify and assert commands?

If the assert fails the application will stop running and any code after the assert will not execute unless surrounded in a try/catch block. Assert.assertEquals(expected, actual) Verify aka softassert will not stop the app from running if it fails softAssert.assertEquals(expected, actual) must use assertAll() at end of test to view assertion results

Difference between an implicit wait and an explicit wait?

Implicit waits are used to provide a default waiting time between each consecutive test step/command across the entire test script. Explicit waits are used to halt the execution until the time a particular condition is met or the maximum time has elapsed

Gherkin

It uses plain language to describe use cases and allows users to remove logic details from behavior tests; it is used in the feature files.

What is JUnit?

JUnit is a Java framework for unit testing. Some of the annotations for JUnit, which are within the org.junit package are: Test - declares a method as a test method BeforeClass - declares a setup method that runs once, before all other methods in the class Before - declares a setup method that runs before each test method After - declares a tear-down method that runs after each test method AfterClass - declares a tear-down method that runs once, after all other methods in the class

Why is Python Selenium better than Java Selenium?

Java programs generally run slower than Python. Java is statically typed and uses curly braces.

What is Jenkins?

Jenkins is an open source tool with plugins built for continuous integration purposes. The principle functionality of Jenkins is to keep a track of version control system and to initiate and monitor a build system if changes occur. It monitors the whole process and provides reports and notifications to alert.

What are listeners in Selenium?

Listeners allow customization of reports and logs.

What is a locator?

Locators uniquely identify web elements.

What is Mocking?

Mocking is a way to test the functionality of a class in isolation. Mocking does not require a database connection or properties file read or file server read to test a functionality. Mock objects do the mocking of the real service. A mock object returns a dummy data corresponding to some dummy input passed to it.

What is Mockito?

Mockito is a mocking framework, Java-Based library that is used for effective unit testing of Java applications. Mockito is used to mock interfaces so that a dummy functionality can be added to a mock interface that can be used in unit testing.

List the advantages of Webdriver over Selenium Server?

Open Source. Language Support. Works Across Multiple OS. Cross Browser Compatibility Testing. Supports Multiple Frameworks and Languages. .

Explain how you can login into any site if it's showing any authentication popup for password and username?

Pass the username and password with url

What is regression testing?

Regression testing is re-running functional and non-functional tests to ensure that previously developed and tested software still performs after a change.

What is the Robot Class?

Robot class has many functions such as keyPress(), keyRelease(), and mouseMove().

Can Selenium handle window based pop ups?

Selenium does not handle window based pop ups. Although you can use the alert interface which has tools such as : void dismiss() - closes pop window void accept() - presses ok on pop window String getText() - retrieves a string from pop up void sendKey() - sends keys to popup

Does Selenium support database testing?

Selenium does not support database testing but can do some tests using the JDBC.

Why is Selenium better than QTP?

Selenium supports more browsers. Selenium is free. Selenium only works on Web applications not mobile apps. Selenium needs a separate repository. Selenium supports more languages.

What is TDD?

Software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against all test cases.

What is Synchronization in Selenium?

Synchronization requires components to work together while testing. You can us Unconditional which specifies timeout values Or you can use Conditional which specifies a condition that needs to be met before the steps continue.

What is automation testing?

Test automation is the practice of running tests automatically, managing test data, and utilizing results to improve software quality.

What are the features of TestNG and list some of the functionality in TestNG which makes it more effective?

TestNG is a testing framework inspired from JUnit and NUnit with new features and easy to use, this can be used for both Unit Testing and End to End testing. Features of Using TestNG are: Test cases can be grouped easily and prioritized easily. Generating HTML report of test runs. Parallel execution of test cases is possible. It allows defining dependent test cases and each test case is independent to other test case. Test logs can be generated. Parameterization is possible. Test cases can be executed on multiple browsers. It can be easily integrated with Maven, Jenkins etc. Assert class is used for verification in TestNG framework.

What is defect/bug lifecycle?

The purpose of Defect life cycle is to easily coordinate and communicate current status of defect which changes to various assignees and make the defect fixing process systematic and efficient.

What is @CucumberOptions?

This annotation tells Cucumber a lot of things like where to look for feature files, what reporting system to use, and which tags to use.

What is the difference between Thread.sleep() and setSpeed()?

Thread.sleep() - pauses the thread for an amount of time. setSpeed() - delays execution for a period of time.

What is a common problem when using Selenium? What does one need to do to prevent it from happening?

Timeout or Sync Issue This problem can be avoided using smart waits like Implicit waits, Fluent waits, and explicit waits that are available within Selenium.

What is the purpose of a runner file?

To run a group of feature files and the associated step files. Cucumber uses @RunWith Junit annotation from Junit framework to run.

What is a unit test case?

Unit testing is a Level of Testing where the smallest part of individual unit/component (called unit) is tested to determine if they are fit for use.

How do you take a screen shot with Selenium?

Use the TakeScreenshot interface. Then use getScreenshot()

Mention 5 different exceptions you had in Selenium web driver?

WebDriverException NoAlertPresentException NoSuchWindowException NoSuchElementException TimeoutException

Difference from Whitebox / Blackbox / Greybox testing

White Box Testing is software testing technique in which internal structure, design and coding of software are tested to verify flow of input-output and to improve design, usability and security. Black Box Testing is a software testing method in which the functionalities of software applications are tested without having knowledge of internal code structure, implementation details and internal paths. Grey Box Testing or Gray box testing is a software testing technique to test a software product or application with partial knowledge of internal structure of the application.

How can you submit a form using Selenium?

You can use the actions interface and use .click().

Selenium

automated testing framework used to validate web applications across different browsers and platforms

How to handle network latency?

driver.manage.PageLoadTime()

What methods can you use with .navigate()?

driver.navigate().forward driver.navigate().back driver.navigate().refresh driver.navigate().to

How do you switch between frames in Selenium?

driver.switchTo.Frame()

How to use a datatable?

feature file must be created and feature and scenario must be declared data table is represented as | name1 | name2 | name3 | under a gurken keyword such as When DataTable must be imported into the objects page and steps file and used as a parameter in the corresponding method or step and retrieved using the row and column

What are steps when dealing with a feature file?

file must be declared with .feature Feature and Scenario must be declared

What is the difference between get() and navigate() in selenium?

get(): It is responsible for loading the page and waits until the page has finished loading. It also cannot track the history of the browser. navigate(): It is only responsible for redirecting the page and then returning immediately. It tracks the browser history and can perform back and forth in the browser.

What is the difference between getWindowhandles() and getwindowhandle() ?

getwindowhandles(): It is used to get the address of all the open browser and its return type is Set<String> getwindowhandle(): It is used to get the address of the current browser where the control is and return type is string

Webdriver adantages

handles multiple frames. Works with multiple languages. Works with multiple browsers.

testng

testing framework used for unit testing, based on junit and nunit. It can execute failed tests and allows for integration with jenkins.


Kaugnay na mga set ng pag-aaral

PET / KET Vocabulary: Clothes and Accessories (with pictures)

View Set

Wheelock's Latin Chapter 1-10 Vocab

View Set

Exam 2 Industrial and Product Safety

View Set