A framework that integrates Spring AI with mobile automation for testing Android applications using Appium.
- Integration with Google Vertex AI Gemini models for test automation
- Support for both API Key and OAuth authentication with Vertex AI
- Mobile automation with Appium for Android devices
- Learning mode to collect test execution data
- Java 17 or later
- Maven
- Android SDK with platform-tools
- Appium server (v2.0+)
- Google Cloud account with Vertex AI API enabled
-
Create configuration files from templates:
# Copy and edit the application properties template cp application.properties.template src/main/resources/application.properties # Copy and edit script templates cp run-web-prod.sh.template run-web-prod.sh cp rebuild-and-run.sh.template rebuild-and-run.sh
-
Update credentials and API keys:
Edit the copied files and replace placeholder values with your actual credentials:
-
In
src/main/resources/application.properties
:- Replace
your-project-id
with your Google Cloud project ID - Replace
your-api-key-here
with your Vertex AI API key
- Replace
-
In script files (
run-web-prod.sh
,rebuild-and-run.sh
):- Replace
your-project-id
with your Google Cloud project ID - Replace
your-api-key-here
with your Vertex AI API key
- Replace
-
-
Make scripts executable:
chmod +x *.sh
-
Start Appium Server:
./start-appium.sh
-
Run the application:
# Using API key authentication ./run-web-prod.sh # For development with rebuilding ./rebuild-and-run.sh
The default authentication method uses an API key for Vertex AI. Configure this in:
- Environment variables:
SPRING_AI_VERTEX_AI_GEMINI_API_KEY
- Application properties:
spring.ai.vertex.ai.gemini.apiKey
For OAuth authentication:
- Generate OAuth credentials in Google Cloud Console
- Run
./authenticate-oauth.sh
to perform the OAuth flow - Run the application with the OAuth profile:
./run-web-oauth.sh
- Never commit sensitive credentials to Git
- All template files are safe to commit (they contain placeholders)
- The actual configuration files with real credentials are excluded in
.gitignore
- Use environment variables when possible instead of hardcoding credentials
spring-ai-mobile-automation/
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/
│ │ │ └── springai/
│ │ │ └── mobile/
│ │ │ └── automation/
│ │ │ ├── config/ # Configuration classes
│ │ │ ├── model/ # Data models
│ │ │ ├── service/ # Business logic
│ │ │ │ ├── ai/ # AI services
│ │ │ │ ├── mobile/ # Mobile automation
│ │ │ │ └── learning/ # Learning system
│ │ │ ├── repository/ # Database repositories
│ │ │ ├── controller/ # API endpoints
│ │ │ └── util/ # Utility classes
│ │ └── resources/
│ │ ├── application.properties # Application configuration
│ │ └── logback.xml # Logging configuration
│ └── test/ # Test classes
├── screenshots/ # Test screenshots
├── logs/ # Application logs
├── data/ # H2 database files
├── pom.xml # Maven configuration
└── README.md # Project documentation
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Spring AI team for the excellent Spring AI framework
- Google Vertex AI for the Gemini model
- Appium community for the mobile automation tools