automation using javascript
TRANSCRIPT
Agenda• Contents
– Automate Website Testing– Automate Mobile Web Testing– Automate Mobile App Testing– Automate Electron Desktop App Testing
• Q&As
2
Web Automation Testing
• Selected tool for browser automation– WebDriverIO
• Selected testing framework– Mocha
• Selected Assertion Library– Chai
3
WebDriverIO
• Selenium 2.0 bindings for NodeJS• Control a browser or a mobile application• Your test code will look simple, concise and easy to read• A simple setup for a wdio test suite with page objects• Support Selenium Standalone service to run Selenium
seamlessly when running tests with the WDIO testrunner
5
Test Framework
• Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun.
• Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
8
Chai Assertion Library
• Is BDD (Behavior-driven development ) / TDD (Test-driven development) assertion library for node & the browser
• Verify the conditions of the test and decide whether test has failed or passed.
• Three different assertion styles–The Expect / Should API covers the BDD assertion
styles.–The Assert API covers the TDD assertion style.
10
Mobile Automation Testing
• Selected test automation tool– Appium
• Selected language to write tests– JavaScript
11
Mobile Automation Testing
What is Appium?Appium ArchitectureHow Appium works in iOS?How Appium works in Android?
12
What is Appium?
• Cross-platform test automation tool for native, hybrid and mobile web apps, tested on – simulators (iOS, FirefoxOS)– emulators (Android)– real devices (iOS, Android, FirefoxOS)
• Is open source
13
Inspect Element Tools
• UIAutomatorViewer - Android– packaged with Android sdk– is present under “tools” folder
• Appium Inspector (both Android & iOS)
• Purpose: Inspect the UI of an application in order to find the layout hierarchy, and view the properties associated with the controls
16
Executing Test
Android• Real Devices• Genymotion
Emulator
iOS• Real Devices• Simulator (as part
of the Xcode tools)
17
Desktop Automation Testing
• Only Application is built by Electron• Selected test automation tool
– Spectron tool
18
• An open source framework for easily writing integrations tests for your Electron app.
• Spectron sets up and tears down your app and allows it to be test-driven remotely with full support for the Electron APIs.
• Built on top of ChromeDriver and WebDriverIO.
20
Tools & Technologies
• WebDriverIO - Selenium 2.0 bindings for NodeJS
• Appium - An open-source tool for automating native, mobile web, and hybrid applications on iOS and Android platforms.
• Spectron - An Electron Testing Framework• Mocha - Test Framework• Chai - Assertion Library
21