How To Explain project

 

How To Explain project and Appium,Cucumber,ProtracQuestion

How to Explain your projects  (Experience -appium experience 2 years, Cucumber 2 years, Angular 7 months)

 

Present Project

 

 

I created my framework from the beginning this company. I started off with selenium hybrid framework then implemented Cucumber and Mobile Testing capability. We can our testcases in mobile test emulator such as in  Android Geny motion. Its integrated with Jenkins and githbu and runs daily

 

I Created a separate similar hybrid framework for running my company APP(please research your company app, every company has it) For my app framework .  There are separate virtual machines for running mobile testcases. Jenkins go to those specific virtual machines for running mobile testing

 

If you  want to add protractor

 

  • Recently my company started making some new application pages(research new applications from your given company) where they are adding angular js locators and logics, for testing those angular pages we are shifting toward protractor. My company gave certified training on Protractor its been  months I am using protractor

 

 

 

Previous project (Experience C# selenium Specflow – 2 years+)

 

My application is built on .Net Framework. That’s why we implemented C# selenium with visual studio. In C# selenium we added SPECFLOW .

 

 

First work experience (Manual test 5 months-, Selenium Experence close to 2 years)

 

Started working as a manual tester for 4 months and started working as Selenium automation tester after companies certified  training.

 

 

 

Cucumber

 

1) What is Cucumber? What are the advantages of Cucumber?

To run functional tests written in a plain text Cucumber tool is used. It is written in a Ruby programming language.

Advantages of Cucumber are:

  • You can involve business stakeholders who cannot code

  • End-user experience is a priority

  • High code reuse

2) What are the two files required to execute a Cucumber test scenario?What are the dependencies needed for cucumber

Selenium-java


Cucumber-jvm-deps

Cucumber-reporting

Gherkin

JUnit

Cucumber-core

Cucumber-java

Cucumber-junit

Two files required to execute a Cucumber test scenario are

  • Features

  • Step Definition

3)  explain the use of Background keyword in Cucumber?

Background keyword is used to group multiple given statements into a single group. The keyword mostly used when the same set of given statements are repeated in each scenario of the feature file.

4) Give an example of a behavior is driven test in plain text?

  • Feature: Visit XYZpage in abc.com

  • Scenario: Visit abc.com

  • Given: I am on abc.com

  • When:  I click on XYZ page

  • Then:  I should see ABC page

5) What is Scenario Outline in feature file?

Scenario Outline is the same scenario can be executed for multiple sets of data using the scenario outline.  The data is provided by a tabular structure separated by (I   I).

 

6) Explain the term step definition in Cucumber

A step definition is the actual code implementation of the feature mentioned in the feature file.

7) Give an example for step definition using “Given” function?

For example to make visitor visit the site “Yahoo” the command we use for given

Given (/^ I am on www.yahoo.com$/) do

Browser.goto “http://www.yahoo.com.”

end – This will visit www.yahoo.com

11) What is the language used for expressing scenario in feature file?

Gherkin language is used to express scenario in feature files and ruby files containing unobtrusive automation testing for the steps in  scenarios

 

12) What are regular expressions?

A regular expression is a pattern describing a certain amount of text.  The most basic regular expression consists of a single literal character.

13) What is BDD?

BDD or Behavior-driven development is a process of developing software based on TDD (Test Driven Development) which focusses on the behavioral specification of software testing units.

14) What does a cucumber features/ support file contain?

Features/ support file contains supporting ruby code. Files in support load before those in step_definitions, which can be useful for environment configuration.

15) What is a Feature file?

Features file contain a high-level description of the Test Scenario in simple language. It is known as Gherkin which is a plain English text language. Feature File consists of the following components  like:

  • Feature: It describes the current test script which has to be executed.

  • Scenario: It is steps and expected outcome for a specific test case.

  • Scenario outline: Scenario can be executed for multiple sets of data using scenario outline.

  • Given: It specifies the context of the text to be executed.

  • When: specifies the test action which has to perform.

  • Then: Expected outcome of the test can be represented by “Then”

16) Why use Cucumber with Selenium?

Cucumber and Selenium are two popular technologies. Many organizations use Selenium for functional testing. These organizations which are using Selenium want to integrate Cucumber with Selenium as Cucumber helps you to read and to understand the application flow.

17) Advantages of Cucumber

Here, are some prominent advantages of using Cucumber.

  • It is helpful to involve business stakeholders who can’t easily read the code

  • Cucumber Testing enhances the end-user experience

  • Style of writing tests allow for easier reuse of code in the tests

  • Allows quick and easy setup and execution

 

 

 

 

 

 

 

18) What is a Step Definition?

Step definition maps the Test Case Steps in the feature files to code. It executes the steps on Application Under Test and checks the outcomes against expected results. In order to execute step definition it must match the given component in a feature.

 

Appium

Q-1: What is Appium and why do you need it?

Answer.

Appium is a free mobile testing tool and available as an open source . It has easy integration with Selenium Webdriver that’s what making it more famous.

Q-2: What’s that one point which made you choose Appium for mobile app testing?

Answer.

It has a unique design which natively supports Selenium. And Selenium is one of the most used and evolving technology for automation testing. It has an open support from the global browser vendors like Google, Mozilla, and Safari. Each one of them agreed to provide their Web drivers implementing the Selenium interfaces 

Q-3: How many types of apps do you know?

Answer.

Mostly there are three kinds of apps in use.

  • Native apps are those which are built using the iOS/Android SDK.

  • Mobile web apps are the ones which are getting accessed via the mobile browsers.

  • Hybrid apps fall into the category which wraps around a <webview>. It’s a native control to enable interaction with the web elements. 

Q-4: What are all the pre-requisites for setting up Appium?

Answer.

You can track all the prereqs from the below list.

  • Android SDK,

  • Eclipse SDK,

  • Compatible JDK version,

  • Selenium Standalone Server Jar,

  • Required Web driver library,

  • TestNG,

  • Appium for Windows or any other platform you are using,

  • APK App info on Google play,

 

 

Q-5: Why should you use Appium? List down some of its advantages.

Answer.

Appium tool has many benefits, some of them are as follows.

  • It’s a multi mobile platform enabler for testing applications.

  • It makes you choose the programming language which comforts you most.

  • It’s free, open source and supported by a large developer community..

  • You can start scaling the tests as you go.

  • It doesn’t have any dependency mobile devices.on the

  • It enables testing on physical devices as well as on the emulators as well.

Q-6: What would you prefer to test on real devices or use simulators/emulators?

Answer.

You can say something like that it’s always best to test on real devices. As it would allow you to catch errors that you may not detect otherwise. But you have to configure the device smartly with the Appium server so that it can detect the device. Sometimes the ADB, the Android debugger may disconnect from the device even if it remains plugged in. And it can cause your tests to fail. To handle such issues, you can write a module which resets the ADB after some time to re-connect the devices.

 

Q-8: How do the tests run on simulators/emulators?

Answer.

The limitation of disconnecting from the devices would never occur with the emulators. They will remain attached to the ADB. You may even set orientation and other hardware-based features that it can emulate.

Running entirely in a virtual world wouldn’t come without some limitations. Your tests would run slow as the emulators consume a lot of memory. Even they might behave intermittently during the execution.

But you can start early testing with them till you acquire the real devices.

 

Q-9: What are the key design concepts behind Appium?

Answer.

  • It’s the <Node.js> server that powers Appium to support cross-platform device testing. And it uses the Webdriver’s JSON wire protocol to run iOS and Android sessions.

  • Once you have the Appium downloaded and installed, it runs an HTTP server which exposes services via REST APIs.

  • This server is responsible for processing the commands from the client and executing them on the target platform.

  • It returns the response in HTTP format which the system handles in an appropriate manner.

  • It utilizes Apple’s <Instruments> for iOS to control the user interface of the target apps.

  • For Android devices, it uses Google’s <UIAutomator> to access API level 16 or higher.

  • There is <Selendroid> to enable access to level 15 or less.

 

Q-10: Which are the test frameworks that Appium supports?

Answer.

  • Appium doesn’t have built-in or default support for any test frameworks.

  • You can use it with many testing tools like Selenium Webdriver.

  • There are some unit test frameworks like <NUnit> and <.Net> which you can use with Appium.

  • Appium provides a driver module that’s what you need for writing test cases.

 

Q-11: What are the essentials for writing the Appium tests?

Answer.

There few things that you need before starting to write test cases in Appium.

  • Driver – It provides a set of APIs to write your Appium tests. It then sends the commands to HTTP server for processing.

  • Session – All Appium tests needs a session for execution. So, first of all, you have to create it. Close it after the automation ends.

  • Capabilities – Like you have to set Chrome driver path to start executing tests in a Chrome browser. Similarly, here you need to define params like PlatformName, PlatformVersion, DeviceName and so on.

  • Commands – These are action words which you use in test steps while you write test cases. Appium has a rich set of commands. Read their syntax and purpose from its online documentation.

 

Q-12: How would you retrieve a DOM element or the XPath in a mobile app?

Answer.

Just like the <FirePath> does in Firefox for Selenium, here you have the <UIAutomateviewer> to locate any element for Android app

Q-13: What is Appium inspector and why is it used?

Answer.

It is similar to the Selenium IDE plugin and enables the record and playback support in Appium. It captures the moves of a native application by inspecting DOM and produces the test scripts in any desired language. However, Appium Inspector does not support Windows and use <UIAutomator> viewer in its option.

 

Q-14: What are the probable errors you might see while working with Appium?

Answer.

Following are the errors you might observe with Appium.

  • Error#1: Missing desired capabilities e.g. Device Name, PlatformName.

  • Error#2: Couldn’t locate ADB. You may have missed setting the <ANDROID_HOME> environment variable.

  • Error#3: Selenium exception <openqa.selenium.SessionNotCreatedException>. It indicates a failure in creating a new session.

  • Error#4: Failure in locating a DOM element or determining the XPath.

 

Q-15: What’s the alternative way to interact with mobile apps while using Appium?

Answer.

You can use JavaScript to interface with the mobile apps. You can employ the Appium commands to send the script to your app. Just wrap it in a static function and execute.

 

Q-16: Can you run multithreaded tests in Appium?

Answer.

Yes, you can. Appium doesn’t prevent you running the tests in a multithreaded environment. Just make sure that no more than one test runs at the same time against the same Appium server.

 

Q-17: Does it require an <.apk> file for automating tests in Appium?

Answer.

Yes, you need the <.apk> package to automate using Appium.

 

Q-18: How to debug failures in Appium test automation?

Answer.

Same as you debug the test case normally 

Q-19: Which are the Selenium commands to use with Appium?

Answer.

There are a no. of Selenium commands to operate with Appium tool. All the selenium commands can be use

  • Locate commands using ID or class names.

  • Raise events on elements e.g. Click().

  • Text commands like type().

  • Get/Set element properties.

  • Commands to run JavaScript. 

Protractor

 

1. What is Protractor?

Protractor is an end-to-end test framework for Angular and Angular JS applications. Protractor runs tests against your application running in a real browser, interacting with it as a user would. Protractor is a node.js port of the webdriver.io, which is the JavaScript implementation of Selenium framework.

 2. What are the prerequisites required to run Protractor?

To run Protractor, we need to have Selenium WebDriver and Node.js installed. We can download Protractor package using npm.

Learn how to install Selenium (latest version)

3. How Protractor, Selenium Server, and Selenium WebDriver work together?

Protractor is an end-to-end test framework for AngularJS applications. Protractor is a Node.js program that supports the Jasmine  frameworks.

Selenium is a browser automation framework. Selenium includes the Selenium Server, the WebDriver APIs, and the WebDriver browser drivers.

Protractor works in conjunction with Selenium to provide an automated test infrastructure that can simulate a user’s interaction with an Angular application running in a browser or mobile device.

4. Why you choose Protractor when testing an application built on Angular or Angular JS and not Selenium?

There is no rule that you must use Protractor when the UI is built with Angular or AngularJS. It depends upon your requirement and team knowledge. Both these tools (Protractor & Selenium) helps us in flawless browser automation.

You can just use plain Selenium for testing Angular applications. Protractor just makes it easier to test Angular application. Protractor is a framework for testing Angular applications.

It has Automatic Waiting for elements and you can access specific Angular elements by.model and by.binding. Also it implements the Page Objects in the framework making tests more maintainable if used correctly.

Some of the points to consider when taking a decision on whether to go with Protractor or not. These points are some of the features of Protractor that make it worthy for testing AngularJS applications.

5. Can Protractor be used for testing Non-Angular JS Applications?

Yes. Protractor can be used for testing Non-Angular JS or Non-Angular Apps.

6. What are the test frameworks supported by Protractor?

Protractor supports two behavior driven development (BDD) test frameworks such as Jasmine & Mocha.

7. What is Jasmine?

Jasmine is an open source testing framework for JavaScript. It aims to run on any JavaScript-enabled platform. It doesn’t require a DOM and it has a clean, obvious syntax so that we can easily write tests.

8. What is Mocha?

Mocha is a JavaScript test framework for Node.js programs, featuring browser support, asynchronous testing, test coverage reports, and use of any assertion library.

9. What is Typescript?

TypeScript is a super set of JavaScript compiled to JavaScript. TypeScript is a strongly typed, object oriented, compiled language developed and maintained by Microsoft. TypeScript may be used to develop JavaScript applications for both client-side and server-side (Node.js) execution.

10. What is a conf file in Protractor?

The configuration file tells Protractor how to set up the Selenium Server, which tests to run, how to set up the browsers, and which test framework to use. The configuration file can also include one or more global settings. The config file provides explanations for all of the Protractor configuration options. Default settings include the standalone Selenium Server, the Chrome browser, and the Jasmine test framework.

11. How to exclude a spec file in Protractor?

You can exclude the spec’s by adding them in the exclude tag in your conf.js file. You can also add patterns to exclude many test scripts with similar names.

Sometimes we may face a situation of running only few tests out of all. In this case, we use exclude tag in our conf.js file to run only few tests. Say we want to exclude test name “myTest.js”

exclude: [myTest.js]

13. What are the locators in Protractor?

Protractor supports all the element location strategies given by Selenium and it also has unique set of locators particularly to identify elements based on AngularJS attributes.

Selenium locators:

by.className

by.css

by.id

by.linkText

by.name

by.partialLinkText

by.tagName

by.xpath

Angular Specific Locators

by.binding

by.exactBinding

by.model

by.repeater

by.exactRepeater

by.options

Other element locator’s introduced in Protractor:

by.buttonText

by.paritalButtonText

by.cssContainingText

by.deepCss

14. How to add custom locator for Protractor?

By using addLocator method.

Refer this example

15. What is ElementFinder?

The ElementFinder simply represents a single element of an ElementArrayFinder (and is more like a convenience object). As a result, anything that can be done with an ElementFinder, can also be done using an ElementArrayFinder.

16. What is an ElementArrayFinder?

ElementArrayFinder is used for operations on an array of elements. The ElementArrayFinder is used to set up a chain of conditions that identify an array of elements. In particular, you can call all(locator) and filter(filterFn) to return a new ElementArrayFinder modified by the conditions, and you can call get(index) to return a single

17. What is browser.refresh in Protractor?

browser.refresh makes a full reload of the current page and loads mock modules before Angular. Assumes that the page being loaded uses Angular. If you need to access a page which does not have Angular on load, use the wrapped webdriver directly.

1

driver.navigate().refresh();

18. What is the difference between “GET” and “NAVIGATE in Protractor?

Get:

Get method is used to navigate to the given destination.

browser.get(“https://www.softwaretestingmaterial.com”);

Navigate:

Navigate method is used to navigate to the given destination

browser.navigate()

if we want to load a previous page or next page in a browser we can use back and forward.

browser.navigate().back();

browser.navigate().forward();

19. How to find all the links on a webpage using Protractor?

We can find all the links on a webpage using tagName ‘a’. Usually all the links are formed with an anchor tag ‘a’ and all the links will have ‘href’ attribute with URL value.

20. How do you verify tooltip text using Protractor?

We can verify tooltip text using protractor by fetching the value of ‘title’ attribute.



Comments

Popular posts from this blog

Important link