You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need to tell the driver to wait for it to become available
ways to wait
halt execution of the program
literally put the thread to sleep
VERY BAD AVOID
Implicit wait
set once on the driver
default amount of time the driver will wait for any element to appear before throwing an error and giving up
Explicit wait
set for a specific element
amount of time the driver will wait for that specific element to appear before throwing an error and giving up
Fluent Wait
Set up polling on an element
retry getting the element every 5 seconds
POM
Page Object Model
Common design pattern for selenium
Create a class that contains the core web elements of the web page
Create an instance of this class to write you code in a more fluid less redundant way
classWikiHomePage:
def__init__(self, driver: WebDriver):
self.driver=driver#Dependency injection of a driver into the web pagedefenglish(self):
element: WebElement=self.driver.find_element_by_id("js-link-box-en") # get element by returnelementdefspanish(self):
element: WebElement=self.driver.find_element_by_css_selector('div[lang="es"]')
returnelementdefitalian(self):
element: WebElement=self.driver.find_element_by_xpath('//*[@id="www-wikipedia-org"]/div[2]/div[8]')
returnelementdefsearch_bar(self):
element: WebElement=self.driver.find_element_by_name("search")
returnelementdefsearch_button(self):
element: WebElement=self.driver.find_element_by_class_name("pure-button-primary-progressive")
returnelement
Testing Terminology
Happy Path Testing
writing a test assuming everything will work correctly and the user puts in valid information
Alternate path testing
writing a test assuming that wrong information is passed in or there is a failure somewhere else in the code
White Box Testing
Writing a test where you can see the code being tested.
unit test or integration test
You can visibly see the code that you test
Black Box Testing
Writing a test where the implementation code is not being observed
Concerned that the results are what you want
For example a Selenium Script that logs in someone is a black box test of the server
You might have 0 idea how the server works
You might not even know what language it is written in
Unit Test (White Box)
An atomic test
A test the checks functionality of a SINGLE FUNCTION
That function SHOULD NOT rely on outside functionality
A service test that uses mocked dependency is a unit test
Integration Test (White Box sometimes called Gray box if some of the code is not viewable)
A composite test
A test that requires multiple pieces of functionality to work correctly to pass
A serivce test that is not mocked requires a DAO that works
A function that has to call other other functions that you have written
End to End Test E2E (usually black obx)
Test an application as an end user
They require the ENTIRE feature to be working in order for the test to pass
Create a book on my web page and see that the book is given an ID and added to my view all books table.
The front-end and the back-end had to be working
Automated Test
Any test executed by a machine
Often used in reference to selenium
But applies to any testing framework
JUnit
pytest
goal as a developer is to automate everything you can
Manual Test
A test performed directly by a human
SDLC
Software Development Lifecycle
There is not perfect official SDLC workflow
you will see different terminolgies
number steps
Some combine steps
Requirements
Initial of creating software
What does the application need to do?
User stories
What are the priorities of this application?
Usability
Speed
Reliabilty
looks amazing
Design
Create the interfaces of the application
Front-end
UI for actual humans
Back-end and general architecture
What language are we using for our server?
What endpoints are there?
What do our entities look like?
What services we might need?
Development/Testing
Implementation
Actually writing code and tests to verify that your code workd
Deployement
Packaging your software in a way that your clients can use it
Web Application might be deployed to AWS
Setting up web servers
Setting up production databases
Desktop App might be burned into CDs
Maitenence/monitoring
Monitoring the in production application
Viewing the amount of traffic it gets
Reviewing the logs generated by the application
Any comments or messages sent by client
reports bugs/ requested features etc....
Waterfall Methodology
Waterfall is the old school approach to building software applications
You only go DOWN the waterfall NEVER back up
Rigid and contract based
If you realize some interface is poorly design.... too bad
You are NOT going to go back and redesign it
Agile
Agile is the more modern approach
It is a mindset
Agile is NOT a specifc practice or set of processes
implementations of agile are
Scrum
Kanban
Agile manifesto (core tenets)
Individuals and interactions over processes and tools
One of waterfall's biggest problem was red tape and team hierarchy preventing bewteen communicating succesffully to solve problem.
Horizontal vs vertical teams
Working software over comprehensive documentation
Waterfall had a HEAVY emphasis on documentation
SRS really explicit technial documents
Working demos explain progess and how the applicaiton is supposed to work way better than the best written docuemention in the world.
Customer collaboration over contract negotiation
Waterfall would generate a litigous SRS document with inflexible requirements
Clients do not really know what they want. They emphasize the wrong things
Better to have weekly updates with the client with demos
Responding to change over following a plan
be AGILE and willing to adapt to the project
Software Engineering is very flexible and editable compared to other fields
If a bridge engineer designs the concrete foundation in a non optimal way