0% found this document useful (0 votes)
53 views7 pages

Interview Questions

autoamtion questions prep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views7 pages

Interview Questions

autoamtion questions prep
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Interview Questions

Q."Find the first non-repeated character in a given string say 'testing'

Str = ""testing""

Output = e"

ANS=
str='yyogeshhh'
for i in str:
if str.count(i)==1:
print(i)
------------------------------------------------------------

"Write a program to check if given string is palindrome or not. Return true if its palindrome,
return false otherwise

Yogesh Warghade
21m ago
str = "nitin"
str1 =str[::-1]
if str == str:
return True
else:
return False

Interviewer
14m ago
---------------------------------------

Write a Python program to reverse a string.

Yogesh Warghade
str = input("enter string")
reverse_str = str[::-1]
print("reverse string is :",reverse_str)

Interviewer
What are Dict and List comprehensions?

-----------------------------------------------------------------------------------------------------------------------

What is the difference between .py and .pyc files?


What is the difference between py and pyc file? PY files contain Python source code file for a
program, while . pyc files contain interpreted bytecode of an application.

. pyc files are bytecode files automatically generated by the Python interpreter during the execution
of . py files. They play a crucial role in improving program execution speed and protecting the security
of the source code.
-----------------------------------------------------------------------------------------------------------------------------
What is swapcase() function in the Python?

Python String swapcase() method converts all uppercase characters to lowercase and vice versa of the
given string and returns it.
---------------------------------------------------------------------------------------------------------------------------

What is webdriver and remote webdriver

Remote webdriver=Selenium lets you automate browsers on remote computers if there is a Selenium
Grid running on them.
Webdriver=A WebDriver is a browser automation framework. It accepts commands and sends them
to a browser on local computer
-------------------------------------------------------------------------------------------------------------------------------

Different types of wait in seleium you have used

--------------------------------------------------------------------------------------------------------------------------------

How to find the xpath of a given element

---------------------------------------------------------------------------------------------------------------------------------

What are the differences between hard and soft assertions? When do we use which
assertions?
In short, if you need your @Test Method to fail straight away after one of its Asserts fails, use Hard
Asserts. If you want the execution to proceed even if an assert fails, if you want to see how the
following asserts behave, and if you want to see the full result at the end of the test, you need to use
Soft Asserts.

Hard Assert is a technique used in software testing to check whether a certain condition is true or
not. In other words, it is a way of verifying that a certain piece of code is working as expected.
If the two outcomes match, the assert statement passes and the test continues. If the actual outcome
does not match the expected outcome, the assert statement fails and the test is halted. The
remaining tests are skipped and the test is marked as failed.

Some widely used assert categories are:

Assert Equals: This includes assertEquals, and assertNotEquals.


Assert Boolean: This includes assertTrue, and assertFalse.
Assert None: This includes assertNull, and assertNotNull.
Assert Identical: This includes assertSame, assertNotSame.

Soft assertions are the ones in which the test execution does not stop if the test does not meet the
assertion condition. The remaining tests are executed. All the above methods also work with soft
assertions.

Hard Assertions

A hard assertion will halt the test execution as soon as the assertion fails.

from selenium import webdriver


import unittest
class TestHardAssert(unittest.TestCase):

def setUp(self):
self.driver = webdriver.Chrome()
self.driver.get('https://example.com')

def test_example(self):
driver = self.driver
element = driver.find_element_by_tag_name('h1')
# Hard assert: this will stop execution if the condition is False
self.assertEqual(element.text, 'Example Domain', "Title does not match")

# If the above assertion fails, the following line won't be executed


print("Assertion passed, continuing with the test")

Soft Assertions

Soft assertions allow the test to continue even if one or more assertions fail. This can be useful
when you want to check multiple conditions and gather all failures instead of stopping at the first
one.

install the softest library

pip install softest

from selenium import webdriver

import softest

class TestSoftAssert(softest.TestCase):

def setUp(self):

self.driver = webdriver.Chrome()

self.driver.get('https://example.com')

def test_example(self):

driver = self.driver

element = driver.find_element_by_tag_name('h1')

# Soft assert: this will not stop the test if it fails

self.soft_assert(self.assertEqual, element.text, 'Example Domain', "Title does not match")


element = driver.find_element_by_tag_name('p')

# Another soft assertion

self.soft_assert(self.assertIn, 'This domain is for use in illustrative examples', element.text, "Text


not found in paragraph")

# Collect all the assertions

self.assert_all()

----------------------------------------------------------
What would be approach of adapting the framework when its a complex application

How to Choose a Framework for Automation Testing:

1. Project Type: Web, Mobile, API, Desktop?


2. Technology Stack: Java, Python, JavaScript, etc.
3. Testing Type: Unit, UI, Functional, Integration, Performance?
4. Team Skillset: Familiarity with the language and framework.
5. Integration: Can it integrate with CI/CD tools like Jenkins?
6. Ease of Use & Maintenance: Is it easy to set up, maintain, and scale?
7. Community Support: Is there good documentation and support?

Best Frameworks Based on Project Type:

 Web Apps: Selenium (Java/Python), Cypress (JavaScript), Playwright.


 Mobile Apps: Appium (cross-platform), XCUITest (iOS), Espresso
(Android).
 API Testing: Postman, RestAssured (Java), PyTest (Python).
 Unit Testing: JUnit (Java), PyTest (Python), NUnit (C#).
 BDD: Cucumber (Java), SpecFlow (C#), Behave (Python).
 Performance: JMeter, Gatling, K6.
 Desktop Apps: WinAppDriver, Sikuli.

--------------------------------------------------

Write a code snippet to perform mouse hover in WebDriver.


actobj = ActionChain(driver)
actobj.move_to(element).click.perform()

-----------------------------

Mention the types of Web locators.


Id
Name
Xpath
Css selector
Link_text
Partial_link_text
classtag

----------------

In a project adopting Behavior-Driven Development (BDD) or Test-Driven Development (TDD),


describe how you would implement a testing framework that aligns with these methodologies.
Include examples of scenarios, steps, and assertions in your preferred language or framework

1.diff between white box testing,grey box and black box testing

White box testing


Testers have full knowledge of the target's internal workings, including the source code and design
documents. This type of testing is used to validate individual components or functions, and to
pinpoint the root cause of defects. dev
Gray box testing
Testers have partial knowledge of the target's internal workings. This type of testing is used to
evaluate interactions and data flow between components, and to test functionality from an end-user
perspective.
Black box testing
Testers have no knowledge of the target's internal workings. This type of testing is used to evaluate
the software's functionality from an end-user's perspective.done by tester

2.program
input l=[2,4,5,5,7]
output=[5,5,7,(2+4)]

def mod(l,i,j):
print(l)
sum=l[i]+l[j]
l.pop(i)
l.pop(j)
l.append(sum)
l=[2,4,5,5,7]
mod(l,0,1)
print(l)

3.program create list and whichever number occurce twice put in differnt list
l=[5,4,5,7,8,4,9,7,8,4,5,]
l1=[]
for i in l:
if i not in l1:
if l.count(i)>1:
l1.append(i)
print(l1)

or

l=[5,4,5,7,8,4,9,7,8,4,5,10]
print(l)
l1=[]
d={}

for i in l:
if i not in d:
d[i]=1
else:
d[i]+=1
for i in d:
if d[i]>1:
if i not in l1:
l1.append(i)
print(l1)
4.suppose you got build from dev in which features are not developed what will you do
First discuss with developer and team about the build
If there is no module depedacy or any dependency in feature if possible I will test the build else I will
report the build in jeera tool as features measing from the build and testing canot be proceded

5.what is payload in api testing


In API testing, a payload is the data that is sent or received in an API call. It's the body of an HTTP
request or response, and can contain information such as user data, configurations, and commands.
Here are some important things to know about payloads in API testing:
Payload formats: Payloads can be in various formats, including JSON or XML.
Payload types: There are three payload formats: request payload, OK response payload, and failed
response payload.
Payload presentation: In a request, payloads are usually presented using curly brackets, {}.

6.review relate questions

7.list/tupple/set

8.what is inheritance,class annd object


9.tell me about your project and its objective
10.which tranformation you have performed on it
11.a | b
1 | 1
0 | 1
1 | 0
1 | 0

what will be output for inner,outer join

12.
std sub mark
1 en 80
2 en 90
1 sc 80
2 sc 90

output should be
std en sc
1 80 80
2 90 90

13.program
l1=[2,3,4,5]
l2=[4,5,7,8]
output=[8,5,28,40]

13.what you did in project,what data tested,what transformation you performed,difficult data
transformation
14. github actions
15.pull & fetch
16.fixture drawbacks,conftest
17.parametrization
18.if wrong code push to github what will youy do
19.markers
20.you have drop down if value repeates you need to skip it how will you do
21.priority/severity
22.stlc-at which phace testing take place
23.jira-status
24.sql-inner/left join/4th max salary with and without subquery
25.comments to review
26.how to raise defetc in jira/filds
27.str reverse using loop and slicing
28.smoke vs sanity
29.process to get content from github make changes and push again
30.create branch
31.choose branch
32.dev does not accept
33.ATM test cases
34.what immutable in list
35.list/dict comprehencension
36.list compre... l=[yogesh,rajesh,vishal] print only those which has y in it
37.reverse list
38.what is pass used for
39.exceptioins and when that occurs
40.stale elemet
41.how to skip test case
42.diff selenium IDE
43.uses of selenium
44.python over other language
45.unique items in list
46.numpy array
47.math library
48.what is lambda
49.diff automation tools
50.how to install pachage
51.array vs matrix
52.iterator
53.numpy library
54.webdriver
55.data models in python
56.xpath vs css selector
57.diff selenium tool used for automation

You might also like