Capybara Testing

Capybara is a web-based test automation software that simulates scenarios for user stories and automates web application testing. We have list down some of the popular interview question in Capybara Testing to help you in your job interview.

Q.1 What are the crucial practices to follow in TDD?

The crucial practices to follow in TDD are:

1. Treat test code as production code

2. Keep each test oracle focused on only the results necessary to validate its test

3. Separate common set-up and teardown logic into test support services utilized by the appropriate test cases

Q.2 What specifies the usage of a web driver by Capybara?
Capybara.default_driver  specifies the usage of a web driver by Capybara.
Q.3 What defines integration testing?
Integration testing tests interactions between modules or subsystems.
Q.4 How does Capybara handles running of an actual HTTP server by drivers?
It is run in same thread.
Q.5 Which type of search is used by Capybara for locating elements?
Case sensitive search is used by Capybara for locating elements.
Q.6 What is Capybara?
Capybara is a web application testing framework for Rack applications, such as Rails, Sinatra and Merb.
Q.7 How do you run capybara test rails?
Capybara is dead simple to add to RSpec. Just add require "capybara/rspec" to the list of require s in your rails_helper. rb .
Q.8 What is Capybara Webkit?
Capybara Webkit is developed around a library called QtWebkit, which is a headless browser acting as a server that listens for commands using a lightweight socket layer.
Q.9 How do you install a capybara?

Step-1: Install Ruby.

Step-2: Install Ruby Development Kit.

Step-3: Install Cucumber.

Step-4: Install Capybara.

Step-5: Install Selenium Webdriver.

Step-6: Install RSpec.

Step-7: Install Ansicon (Optional)

Q.10 What is the file extension for a feature file?
File Extension for a feature file is .feature. A feature file is ideally written in a notepad file and is saved with the extension feature.
Q.11 What is meant by a feature file?
A feature file provide a high-level information of an Application Under Test (AUT). The first line of the feature file must start with the keyword ‘Feature’ followed by the description of the application under test.
Q.12 What is Behaviour Driven Development (BDD)?
BDD is a methodology to understand the functionality of an application in the simple plain text representation.
Q.13 What is the main objective of Behavior Driven Development (BDD)?
The main objective of the Behavior Driven Development framework is to make numerous project roles such as Business Analysts, Quality Assurance, Developers, Support Teams understand the application without diving deep into the technical aspects.
Q.14 What is the limit for the maximum number of scenarios that can be included in the feature file?
A feature file can contain a maximum of 10 scenarios, but the number can vary from project to project and from one organization to another.
Q.15 Explain Cucumber?
Cucumber is a tool that is based on Behavior Driven Development (BDD) methodology. Its main objective is to make various project roles such as Business Analysts, Quality Assurance, Developers, etc., understand the application without diving deep into the technical aspects.
Q.16 What programming language is used by Cucumber?
Cucumber tool provides support for multiple programming languages such as Java, .Net, Ruby etc. It can also be integrated with multiple tools such as Selenium, Capybara, etc.
Q.17 Mention the components of the feature file?
1. Feature 2. Scenario Outline 3. Scenario 4. Given 5. When 6. Then
Q.18 Define regular expressions?
A particular amount of testis expressed with the help of a pattern known as the regular expression. Mainly texts containing single characters are expressed with the help of this pattern.
Q.19 Differentiate between Cucumber tool and Rspec?
The cucumber tool is used for testing various software. It can also be used for integration and system tests. However, on the other hand, Rspec is used for the purpose of Unit Testing.
Q.20 What is DSL capybara?
Capybara consists of a user-friendly DSL which explains actions that are executed by the underlying web driver.
Q.21 List some web drivers supported by Capybara?

1. rack::test

2. selenium-webdriver

3. capybara-webkit

Q.22 Explain the rack::test driver?
This driver is considerably faster than other drivers, but it lacks JavaScript support and it cannot access HTTP resources outside of the application for which the tests are made.
Q.23 Explain selenium-webdriver?
Capybara supports selenium-webdriver, which is widely used in web-based automation frameworks. It supports JavaScript, can access HTTP resources outside of application, and can also be setup for testing in headless mode which is especially useful for CI scenarios.
Q.24 Explain the capybara-webkit driver?
For creating true headless testing with JavaScript, we use the capybara-webkit driver. It uses QtWebKit and it is significantly faster than selenium as it does not load the entire browser.
Q.25 What is RSpec?
RSpec is a hugely popular behavior driven development (BDD) oriented testing framework in the Ruby community.
Q.26 What is the role of Ruby in capybara?
Capybara is written in the Ruby programming language.
Q.27 What's good about the capybara web browsers?
The good thing about capybara web browsers, is that you can use selenium backend while you work on your script, and move to Phantomjs when it’s done. This way, you will see what is going on while you do the hacking, and executes without opening any extra windows when you are done and want to use it.
Q.28 What is RackTest?
Rack::Test is a small, simple testing API for Rack apps. It can be used on its own or as a reusable starting point for Web frameworks and testing libraries to build on.
Q.29 What do you know about Poltergeist?
Poltergeist is another headless driver which integrates Capybara with PhantomJS. Moreover, it also detects and reports any Javascript errors that happen within the page.
Q.30 Can you switch between different drivers in Capybara?
Yes, capybara makes it convenient to switch between different drivers. It also exposes an API to tweak those drivers with whatever settings you want, or to add your own drivers.
Q.31 What is asynchronous in JavaScript?
Using asynchronous JavaScript such as callbacks, promises, and async/await, you can perform long network requests without blocking the main thread.
Q.32 What is Ajax?
Ajax is a set of web development techniques using many web technologies on the client-side to create asynchronous web applications.
Q.33 What is RPC communication?
Remote Procedure Call is a technique for building distributed systems. It allows a program on one machine to call a subroutine on another machine without knowing that it is remote.
Q.34 Where is RPC used?
The RPC interface is generally used to communicate between processes on different workstations in a network. Moreover, RPC works well for communication between different processes on the same workstation.
Q.35 What is RPC example?
RPC in experiments at CERN include: remote monitoring program control, remote FASTBUS access, remote error logging, and remote terminal interaction with processors in VMEbus
Q.36 How to make debugging effective?

1. Understand Capybara waiting behavior. Default waiting behavior is the key aspect to understand in writing Capybara specs.

2. Use break points.

3. Tail the logs.

4. Reload your objects before asserting object values.

5. Test Failure Screenshots.

Q.37 What are the types of debugging?
There are two main types of debugging you can use to debug the issue: PHP Debugging and JavaScript debugging.
Q.38 What is a debugger used for?
A debugger is a tool that is typically used to permit the user to view the execution state and data of another application as it is running.
Q.39 What is Document Object Model (DOM)?
The Document Object Model (DOM) is a tree-like in memory structure, which browsers construct when parsing an HTML page and processing JavaScript that exists either inline in the page or loaded via script tags.
Q.40 What is Cascading Style Sheets (CSS)?
Cascading Style Sheets (CSS) is a style sheet language useful for describing the look and formatting of a document written in HTML or XML. Moreover, CSS Selectors are patterns used to select the styled elements.
Q.41 What are the benefits of Capybara Testing?
1. Firstly, No setup is necessary for Rails and Rack application. Works out of the box. 2. Secondly, Intuitive API which mimics the language an actual user would use. 3. Subsequently, Switch the backend your tests run against from fast headless mode to an actual browser with no changes to your tests. 4. Lastly, Powerful synchronization features mean you never have to manually wait for asynchronous processes to complete.
Q.42 What are Modals?
Modals are in drivers which support it, you can accept, dismiss and respond to alerts, confirms and prompts.
Q.43 What is the use of Querying in Capybara?
Capybara has a rich set of options for querying the page for the existence of certain elements, and working with and manipulating those elements.
Q.44 What happens when exact is true or false?
When exact is true, all is expressions match exactly, when it is false, they allow substring matches.
Q.45 When is a new session created?
A new session will be created using the current driver if a session with the given name using the current driver and test app instance is not found.
Q.46 What is the use of Named sessions?
It is used to perform operations in a different session and then revert to the previous session
Q.47 What is Scoping?
Scoping makes it possible to restrict certain actions, such as interacting with forms or clicking links and buttons, to within a specific area of the page.
Q.48 What is testing in JavaScript?
JavaScript Unit Testing is a testing method in which JavaScript test code written for a web page or web application module is combined with HTML as an inline event handler and executed in the browser to test if all functions.
Q.49 What is meant by unit testing?
A unit test is a way of testing a unit - the smallest piece of code that can be logically isolated in a system.
Q.50 What is Integration Testing?
Integration testing is a type of testing used to check the combinations of different units, their interactions, the way subsystems combine into one common system, and code compliance with the requirements.
Q.51 Give one example of Integration Testing?
when we check login and sign up features in an ecommerce app, we view them as separate units.
Q.52 What is Responsive Layout Test?
The Responsive design test means testing the website or URL from different devices.
Q.53 What do you understand by Acceptance Testing?
Acceptance Testing is a method of software testing where a system is tested for acceptability.
Q.54 What is the major aim of Acceptance Testing?
The major aim of this test is to process the compliance of the system with the business requirements and assess whether it is acceptable for delivery or not.
Q.55 What are the types of acceptance testing?
1. Alpha & Beta Testing. 2. Contract Acceptance Testing. 3. Regulation Acceptance Testing. 4. Operational Acceptance testing.
Get Govt. Certified Take Test