Nothing Special   »   [go: up one dir, main page]

Asa All

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

SELENIUM – ALL IS WELL-SARAH

Sarah as an automation engineer onboards on a health care project end- 2-end test automation
for the web application “All is Well” selenium using java stood as the approval by the client
for performing web UI automation and TestNG for designing the testing framework. Sarah
and her team must start the project work from scratch to complete this testing phase. Sarah
and her team in liaison with client policies had decided to
go with the implementation of test automation for their web application. The current project
uses maven to build, selenium to automate the interaction of web UI, TestNG to design test
classes and methods GIT/Inner Source codes to manage source to codes, extent reports to
generate rich HTML reports with a dashboard view and Jenkins to continuously test the
application.

1. Sarah desires to execute the below given code, wherein all the Assert statements
must be executed and validated even if one of the Assert statements is failed.
Ans: Option B (SoftAssert Assert = new SoftAssert(); // place missing code in the line no. 11
Assert.assertAll(); // place missing code in line no. 18 ) V

2. Sarah completed the creation of the Maven project in Eclipse, with all desired
dependencies and plugin configured in the pom.xml file. She has now started
designing the TestNG class as shown below.
A box of code will be there
Ans: option B
1 include & 2 exclude
2 exclude
1 include V
All are without brackets
Correct answer :- where ever bracket is not there in methods/class/test/suite that would
be correct answer

3. Sarah has created a maven project in eclipse, and trying to add required
dependencies like selenium, testing in pom.xml file. Suggest her with the right
approach of adding dependencies in the pom.xml file from the below
options.
Ans: option D V

4. Sarah must generate a stunning HTML report with a dashboard along with
screenshots of the page whenever there is a failure in the test automation. She used the extent
API java library for creating the HTML reports.
Ans: option A ( A-2 B-3 C-1 )

V
5. Sarah must automate and test the selection of a specific drug from a drop-down box
based on the selection of disease from another drop-down ... The developers
designed the UI in such a way that only ......... the drug data is feteched from the server based on
a search query there can be some delay in response on the page.
Ans: option C ( line no. 6 -------- webdriverwait wait =new
WebDriverWait(driver.DurationofSeconds(10));) V

1 WebDriver driver-DriverUtil.getBrowser Instance("chrome") ;

3 Select dropDown1=new Select(driver.findElement(By.id("disease-name")

4 dropDown1.selectByVisibleText("Fever"); ;

6 WebDriverWait wait=new WebDriverWait (driver, Duration.of Seconds (10));

7 wait.until(ExpectedConditions.presenceOfAllElementLocatedBy (By.id("d
name')));

9 Select dropDown2=new Select (driver.findElement(By.id("drug-name")));

10 dropDown2.selectByVisibleText("Calpol");

6. Sarah needs to automate and test a scenario for performing data-driven testing. She is using
some sensitive data like passwords, CVV as test data in her scripts.

Ans: option C (5 lines code option) V


1 WebDriver driver=DriverUtil.getBrowser Instance("chrome");

2 String originalPWDInput= "get data from any sources like x1/db

etc.";

3 String encodedString =

Base64.getEncoder ().encodeToString(originalPWDInput.getBytes());

4 String decodedString = new

String(Base64.getDecoder ().decode(encodedString));

5 driver.findElement(By.id("Password")).sendKeys (decodedString);
7. Sarah must automate and test the selection of language preferences to the patients (users) to
support localization. She wants to select Hindi from the given language preferences to test the
navigation of the page. Assist her with all the possible locator selections to select the desired
language.

Ans: option A, B, C V

a driver.findElement(By.xpath("//tbody/tr [3]/td[2]")).click();

b driver.findElement(By.linkText("hindi written in hindi")).click();

c driver.findElement(By.cssSelector('tbody tr:nth-child(3) td:nth-child(2)")).click();

8. Sarah must automate and test the input box which is the iframe area. After entering the input
value in the input box now she wants to click on the home page link. The developers designed the UI
code shown below.

Ans: option B V

1 WebDriver driver=DriverUtil.getBrowser Instance("chrome");


2 driver switchTo().frame("SingleFrame");

3 driver.findElement(By.name("iframetextbox")).sendKeys("welcome to

selenium");

4 driver.switchTo().defaultContent();

5 driver.findElement(By.linkText("Home")).click();

9. Sarah must automate and test a scenario where she needs to explore more on drug names by
category. Hovering mouse over a web element labeled as "drug by category" will only display the list
of choices by category, else the category items from the list are hidden and not identifiable. The
developers designed the UI code as shown below.

Ans: option D
10. Sarah has created a maven project in eclipse with all desired dependencies like

selenium and testing in the pom.xml file. Now, she must configure plugins in the

pom.xml file to execute the tests from an external environment like maven or Jenkins.

Ans: option D

V
UFT-Food Cart-Sarah
User Story for a Food Ordering Application "FoodCart"
Peter is a regular customer of "FoodCart" and is using the wine food. He logs into the application
using his Customer Id and Pi selects the location of food delivery using Maps, integrated with Once
the correct address is detected, he proceeds to the 'Men desired food items. He adds multiple items
to the cart and navi verifies the added food items, their quantity and navigates to "E he views the
following details in the Order table Item No, Item Net Price Below the Order table he views the Total
Price, whi navigates to the Payment and pays using one of the payment banking, and Paytm) On
successful payment, the Order Conf displays a message The order with Id BILL9999999999_1001

1. You have already extracted the message displayed on the "Order Confirmation" window and
stored it in a message" variable. Now, you want to write a custom code to fetch the bill id from the
message in a functionsub and call it when required. Which of the following options will help you
write the custom code to fetch the bill id from the message in a function/sub?

Answers:- option 4
th
V

Function getBillId(ByRef message)


return Right(Left (message, 38),19)
End Function

2.You have customized the test script to perform parameterization and run multiple times for
multiple login credentials. The expel file used for parameterization contains 3 columns and 10 rows
of data (1st row containing the column names). The test script is customized with a For loop to read
data from an excel file and literate on all the rows of test data. On execution, you noticed that the
test script is running more than the expected iterations. Which of the following options provides the
best suitable solution to fix the problem?

Answers: - 2nd option V

Do not make any change in the For loop iterations. Go to the Test Run Settings,
Select Run one iteration only
3.You have customized the script to fetch the Unit Price, Quantity, and Net Price for all the food
items in the Order table. You want to validate if the Net Price is calculated property based on the
Unit Price and Quantity. Which of the following options will help you write the custom code best
sulted to perform the desired validation? Assume the extracted data is in variables (unitPrice, qty,
netPrice)

Answers: - 3nd option V

4. You want to customize the test results with some additional Information regarding the test
execution, along with porting the necessary status and message. Which of the following options will
help you customize the test results required?
Answer: 1st Option V

ReportHTMLEvent……AddRunInformation
5.One of your teammates has already created a test TC001", which contains the script for the
customer login. He has shared the test with you. This test contains a non-reusable action
"Customer. Login". You want to use the script in your test, as a starting point. Which of the
following best represents your situation to reuse the customer login script?

Answer: 4th Option V

You can perform “Call to Copy of Action” and use the below line of code as the starting point
RunAction “Copy of CustomerLogin”,oneIteration
6. You want to customize the test script to extract the message displayed on the "Order
Confirmation window. This message contains the order confirmation details with the Bill Id. During
recording, you did not interact with the order successful element, so it is not captured in the OR.
Which of the following options will help you write the custom code to extract the message displayed
by the order successful element?
Answer: 1st option V

Message = WpfWindow(“devname :=Order


Confirmation”).WpfObject(“devname:=orderSuccessful’).GetROProperty(“text”)

7. You want to parameterize the test script to run multiple times and perform the test automation
for multiple login credentials. The input test data for Customer Id and Password is stored in columns
Custom rid" and "Password" in an excel file with a sheet name "LoginData" You want to extract the
data from the excel file columns and store them in local vanables Which of the following options will
help you customize the scmpt to extract the desired data from the excel file?
Ans: - 1st option V
8. After recording the test script, you want to perform a few customizations to design the test
scenarios You want to interact with the Order table and fetch the Unit Price, Quantity, and Net Price
for all the food items. Which of the following options will help you write the custom code?

Answer: 1st option V


1 For row = 1 To numberOfItems step 1

2 unitPrice =

WpfWindow(“Billing”).WpfTable(“Order”).GetCellData (row,2)

3 qty = wpfWindow(“Billing”).wpfTable(“Order”).GetCellData

(row,3)

4 netPrice=

wpfwindow(“Billing”).wpfTable(“Order”).GetCellData(row,4)

5 Next

9. You have decided to generate the test scripturing recording options in UFT Which of the following
recording styles is most appropitiae to use for generating a script based on the gen user story?
Answer: 1st option

Start recording with contextual sensitive mode and then we should switch to low level recording
mode and then again switch back to the context sensitive
10. You want to parameterize the test script to run multiple times and perform the test automation
for multiple login credentials. The excel file already has 3 columns (Customer id, Password, Status)
Conformed and Password columns are used to store the input data for parameterization. The status
column will be updated automatically after the test execution. You want to update the "Status"
column in the excel file with the test result status Login Successful" or "Login Failure".
Which of the following options will help you customize the script?
Answer: 1st Option V
iRail
User Story for an iRail Application

Current Situation: Let's start the first day of a new project. We are working for an iRail client Presently in the
iRail application, all the customers can buy the tickets in advance, however, the seats will not be guaranteed.
New Requirement. To encourage people to get the reserved seat, Rail wanted people to book their seats
during the time they buy the tickets in advance.
iRail client reached out to Accenture to implement the user stones The client has decided to use the Agile
methodology and BDD approach to drive the SDLC

To get started, there are two user stories that are identified

• Seat allocation automatically

• Highlight reserved seats in the carnages

User Story Seat allocation automatically

To start the work, the team has planned to follow three BDD practices.

- Discovery

- Formulation

- Automation

Business Rules

-The application can't allow booking for more than 75% of seats in the carriage

1. What will be the correct BDD and TDD sequence of steps which will be followed to develop the given user
story?

Ans: Write the fail acceptance scenario -> Write the fail unit test -> pass unit test -> pass acceptance scenario
2. The QA team wanted to perform test execution for all the scenarios. Select the correct tag expression for
performing the appropriate test execution?

1 @userstory-1

2 Feature: Application Skill Assessment

4 User Story: Customers who purchase the tickets in advance should be given a chance to book seats immediately

6 Business Rules:

7-Ideally, the application can not book seats more than 75%
8

9 @smoke

10 Scenario: The one where carriage have seats less than 75%

11 Given a train has carriage X with total seats as 12

12 And the booked seats are 6

13 When user book 1 seat

14 Then the application should allocate a seat in carriage X

15

16 @sanity…………………

Ans: option C

@userstory-1

3. Which option will be considered by the client, covering all the best practices to create feature files
in BDD?
Ans: option A
4. The QA team wants to perform test execution for sanity and smoke test plan. Select the correct
tag expression for executing the sanity and smoke testing scenarios from the below feature file?
1 @userstory-1

2 Feature: Application Skill Assessment

4 User Story: Customers who purchase the tickets in advance should be given a chance to book seats immediately

6 Business Rules:

7-Ideally, the application can not book seats more than 75%

9 @smoke

10 Scenario: The one where carriage have seats less than 75%

11 Given a train has carriage X with total seats 12

12 And the booked seats are 6

13 When user book 1 seat

14 Then the application should allocate a seat in carriage X

15

16 @sanity

17 Scenario: The one where user is able to make the booking successful

………

Ans: option B

@smoke and @sanity


5. The QA team has prepared the acceptance scenarios for the given user story and wants to run the
complete test automation suite.
Identify the correct runner class with correct @RunWith and @CucumberOptions with the below
conditions?
-Generate JSON, HTML, and JUnit reports
-Run all smoke scenarios
-Feature directory location
-Step Definition location
Choose the right choice from the given options with the night configuration in the Runner class
Ans: option B
6. The QA team has developed the page object model for the automation framework. They have
written a separate page package and kept all the page object classes. For the login web page, the
team has written the LoginPageObject class as shown below
1 public class LoginPageObjects {
2
3 _ _ _fill the missing part 1 here_ _ _
4
5 _fill the missing part 2 here. (how-How.ID, using="userName"}
6 private WebElement uname;
7
8 _fill the missing part 2 here (how-How.ID, using="password"}
9 private WebElement password;
10
11 fill the missing part 2 here (how=_fill the missing part 3 here_ ,using="Login")
12 private WebElement login_button;
13
14 public LoginPageObjects (WebDriver driver) {
15 this.driver=driver;
16 fill the missing part 4 here…..
…………..
Ans: Option 4
7. For the below scenario, what would be the best practice to follow to creat step definitions using
cucumber expressions?
1 Scenario: The one where user make the booking successful
2 Given carriage X has 5 seats available out of 12
3 And carriage Y has 1 seat available out of 12
4 When user A book 1 seat
5 And user B book 2 seats 6 Then the application should allow the booking
Ans: option D

8. What would be the correct scenario for the below example?

Example: Carriage X and Y has total 12 seats each carriage X has 75% seats booked and carriage Y
has 70% seats booked. Considering the business rule, the application can’t allow more than 75% seat
booking and the customer is trying to book 3 seats. Identify the scenario which will be in the given
example.

Ans: option D
9. For the below scenario, what would be the correct step definition generated by Cucumber?
ANS:- B
Ans:

10. The QA team has written the Cucumber Data Table in the scenarios to implement Data Driven
Testing. Help the team to select the correct DataTable conversion types?

Ans: Option C
DIGI BANK

A client DigiBank has reached out to Accenture to implement the banking digital creator which can
be provided to the customers. Currently, DigiBank has only provided services to the customer
through the branches located across different regions New requirement in order to expand the
banking horizons, the client wanted to implement multiple digital solutions like ATM, Digital wallets,
Mobile App, etc.
DigiBank client reached out to Accenture to implement the user stories. The client has decided to
use the Agile methodology and BDD approach to drive the SDLC. To get started they have identified
multiple user stories.
- Account holders to access different digital solutions
- Premium Accounts

To implement the user story, the client has planned to follow three BDD practices.
- Discovery
- Formulation
- Automation Business rules:
- Account holders can only access the digital banking privileges
- The premium account customers can only get the home loan offer

1. ………. They are planning to perform the ......... color cards for different information to be
……in three amigos meeting?
Ans: option A (Yellow cards for user story, blue card for acceptance criteria, green ........... And red
card for questions)

2. The QA team wanted to perform test execution only for smoke and sanity scenarios for the below
feature file.
Select all the options with correct tag expressions to perform the appropriate test execution?
Some box will be there

Ans: option A and D (@smoke and @sanity and not @regression) & (@smoke and @sanity)

3. All the options where we can apply tags?


Ans:
option A and C (Feature, Scenario) & (scenario outline, examples)
4. For the below scenario, select all the options with correct cucumber expressions, data
table, and data table conversion?

Ans: option A & B


5. The QA team has prepared the acceptance scenarios for the given user story and wants to
run the complete test automation suite.
Identify the correct runner class with correct @RunWith and @cucumberOptions with the
below
conditions?
-generate json,html, and junit reports
- run all sanity scenarios
-feauture directory location
-step definition location
-check whether all feature file steps have the corresponding step definitions
-provide console output on a readable format
Ans: Option B

6. The QA team has …… to be automation framework. They have …… page object classes
inside the package .
For the login web page, the team has written the LogicPageObject cases as shown below:
Ans: option C
//place at line 3
Private webDriver driver;
//place at line 5
@FindBy(how=How.PARTIAL_LINK_TEXT,using=”SignIn”)
Private webElement signIn;
//place at line 16
Public LogicPageObjects(WebDriver driver) {
this.driver=driver;
PageFactory.initElements(this.driver, this);
}
7. For the given scenario, choose the option with correct cucumber expressions?
Scenario : the one where the customer choose different digital solutions
Given Ted hold 2 accounts in digiBank
And Tia hold 1 account in DigiBank
When ted choose “ATM” for transaction
And tia choose “mobile app” for transaction
And Ted withdraw $100
And Tia transfer $20
Then the transaction are successful.
Ans: option B
option where only integer is mentioned and not string

8. Given the below example:


Customer Ted holds the premium account in digibank, and customer tia holds the normal account in
digibank. Considering the business rule, all account holders can access the digital banking privileges
and the premium account customers can only get the home loan offer. Select all the correct
scenarios meeting the business requirement for this example?
Ans: option A, B & C
9. For the below scenario, what would be the correct step definitions generated by
cucumber?

Ans: option C
10.

ANS:- A
Shopify
Sean as an automation engineer onboards to an e-commerce project to perform End-2-End test
automation for their web application “Shopify”.
Selenium using Java stood as the approval by the client for performing web UI automation & TestNG
for designing the testing framework. Sean and his
team must start the project work from scratch to complete this testing phase. The current project
uses Maven to build, Selenium to automate the
interaction of web UI, TestNG to design test classes & methods, GIT/InnerSource to manage source
codes, Extent Reports to generate rich html
reports with a dashboard view, and Jenkins to continuously test the application.

1. Sean wants to generate a stunning HTML report with a dashboard along with screenshots of the
web page whenever there is a failure in the test automation. He uses Extent API Java library for
creating the HTML reports as shown below:

Suggest Sean with the missing code lines in order to perfectly create the reports when he executes
the above code.
Ans:

2. Sean wants to create a maven java project to design the test cases for performing test
automation. He needs to follow some of the best practices while creating the folder structure in the
project. Suggest him with the appropriate folder structure to achieve the best practises for test
automation.
Ans:

3. Sean wants to identify a web element "Irani" from the below given UI html code. He is writing an
automation script using WebDriver API to locate this
element.

Suggest him with the right option to identify & click on the desired Web Element.
Ans:
4. Sean wants to automate all test scenarios on the Chrome web browser. Identify correct ways of
Instantiation & Initialization of the WebDriver along with the launching of the Application Under
Test from the below-given options.
Ans: option A,B,C

5. Sean started initially designing the TestNG classes in a customized java package to perform
automation functional tests for various scenarios. He wants to execute all the test classes at the
same time. Suggest Sean with the right configuration in the testng.xml in order to execute his test
codes as a testsuite.
Choose the most appropriate option.
Ans:

You might also like