Cucumber BDD framework with Appium:
What are we automating?
=========================
Sauce Lab's demo mobile app
GitHub: [Link]
Releases (Latest APKs and IPAs):
[Link]
iOS: Steps to build app for simulator:
Refer this lecture from TDD framework design: Page Object Model (POM) Design with
Appium - Part 4
Watch from 9:02 minutes to 17:40 minutes
Login Feature file
Scenarios:
Login with an invalid user name
Login with an invalid password
Login with a valid user name and password
Products Feature file
Scenarios:
Validate product info on Products page
Validate product info on Product Details page
Steps:
=======
1. IntelliJ setup for Cucumber
===============================
[Link]
Download community edition
Install by selecting default options
Launch
Select default options
Configure -> Plugins -> Search Cucumber -> Install plugin "Cucumber for Java".
It will ask to install Gherkin plugin as well.
Restart IDE
2. Maven setup
===============
[Link]
Download Zip
Unzip and copy to say c:\maven
Windows:
Edit System environment variable PATH and add c:\maven\bin
Open command prompt and type mvn -v
Mac:
Open terminal and navigate to home dir by typing cd ~/
open -e .bash_profile
Add <path_to_maven_bin_folder> to PATH
type mvn -v
Note: If on latest Mac OS Catalina, it uses zsh and not bash.
What this means is, your change will not persist if you exit and launch terminal.
To resolve this, refer first comment on my video: [Link]
For any issue, you can always refer Maven website or search on internet. This is
fairly simple setup.
3. Create new Maven project
============================
4. Add Cucumber JVM and Cucumber-JUnit dependencies
===================================================
[Link]
[Link]
5. Add other dependencies: Appium, JSON, Log4J2
===============================================
6. Create Runner file: src/test/java/com/qa/runners/MyRunnerTest
========================
[glue, features]
7. Create feature files:
===========================
src/test/resources/[Link] and [Link]
Gherkin basics - [Link]
8. Create step defination files:
================================
src/test/java/com/qa/stepdef: Login and Products
[Link]
9. Copy apps to src/test/resources/app
=====================================
10. Copy [Link] and [Link]
=========================================
log4j2 configurations: [Link]
Video Tutorials: [Link]
list=PLIuQPt4XLm7BEVaydA8zSt4zpguT1joN_
11. Copy TestUtils class to src/main/java/com/qa/utils
======================================================
12. Create hooks under src/test/java/stepdef
=============================================
13. Create GlobalParams under src/main/java/com/qa/utils
========================================================
platformName, udid, deviceName, systemPort,chromeDriverPort, wdaLocalPort,
webkitDebugProxyPort
14. Initialize global params and add Thread Context for Log4j2 in Before hook
========================
15: Create ServerManager
===========================
Programmatically start Appium Server (Mac and Windows):
[Link]
16. Start server in Before hook and stop service in After hook
=============================================================
17. Create PropertyManager
===========================
18. Create CapabilitiesManager
=============================
19. Create DriverManager
===========================
20. Initialize driver in Before hook and Quit in After hook (and set to null)
====================================
21. Add Base Page and Page Objects
===================================
Page Object Model design and Scrolling: [Link]
list=PLIuQPt4XLm7BEVaydA8zSt4zpguT1joN_
22. Update step defination files with actual code
================================================
23. Execute Runner and "mvn test" with parameters
================================================
24. Embed Screenshot in Before hook
=====================================
25. Create VideoManager
========================
Video tutorial: [Link]
list=PLIuQPt4XLm7BEVaydA8zSt4zpguT1joN_
26. Start video in Before hook and stop in After hook
=========================
27. Moving server and driver initialization from Cucumber hooks to JUnit's
BeforeClass and AfterClass
===============================
28. Execute Runner and execute "mvn test" with parameters
=========================================================
28. Integration with Cucumber HTML Reports
============================================
cucumber-jvm reports (Jenkins plugin): [Link]
reports-plugin
cucumber-jvm reports (cucumber): [Link]
reporting-plugin
Add Dependency
Add plugin in Runner
29. Import project on Mac and execute for iOS using terminal
==============================================
Revise mvn setup
navigate to home directory cd ~/
open -e .zprofile
30. Execute for both iOS and Android in parallel
================================================
Seperate tutorials:
=====================
Cucumber with TestNG
=====================
- Parallel Execution
Extent reporting
======================
- Using API
- Using Adapter
- Parallel Execution
Dependency injection:
=======================
[Link]
[Link]
using-picocontainer
Extent reports:
use adaptor (current: 1.0.11)
use spark reporter
[Link] example that's working:
[Link]
[Link]
[Link] example: [Link]
cucumber4-adapter/issues/20#issuecomment-601591963
Note: currently, @Before and @After are working, but @BeforeStep and @AfterStep
aren't. This will be fixed in the upcoming version 1.0.12 release, fix available
with 1.0.12-SNAPSHOT.
category and author using adapter?