This project automates and tests Google Cloud Storage CLI commands using TestNG, Allure for reporting, and Playwright for signed URL validation.
This section provides step-by-step instructions on how to build and run the project using Docker.
-
Build the Docker Image:
docker build -t gcloud-tests . -
Run the Docker Container:
docker run -it --rm gcloud-tests
This command will start the container and prompt you for authentication.
-
Authenticate with Google Cloud:
-
Verify that the Project and Bucket are Created:
- After authentication, the setup script will create the necessary Google Cloud project and storage bucket.
- You can verify this by running:
gcloud projects list gcloud storage buckets list
-
Expected Output:
- After a successful setup, you should see output confirming the creation of the project and bucket
Now your Google Cloud project and bucket are ready for testing!
β Automated tests for Google Cloud Storage CLI commands:
- Create a bucket
- Upload a file
- List files in a bucket
- Generate a signed URL
π Modular test framework for easy expansion
π Allure Reporting for clear test execution insights
π Maven-based project for easy build & dependency management
Make sure you have the following installed:
- Java 21+ β
- Maven β
- Google Cloud SDK β (Ensure gcloud CLI is authenticated and configured)
- Allure CLI β (For test reporting)
git clone https://github.com/yourusername/CloudStorageCLI-Testing.git
cd CloudStorageCLI-TestingEdit ProjectConfig.java to match your GCP setup:
public class ProjectConfig {
public static final String BUCKET_NAME = "your-bucket-name";
public static final String TEST_FILE_NAME = "test-file.txt";
public static final String G_CLOUD_PATH = "\"C:\\Program Files (x86)\\Google\\Cloud SDK\\google-cloud-sdk\\bin\\gcloud.cmd\"";
}Execute tests using Maven:
mvn clean testAfter running the tests, generate the Allure report:
allure serve target/allure-results| Test Name | Description |
|---|---|
| testCreateBucket | Checks if the bucket exists, creates if not |
| testUploadFile | Uploads a test file to the bucket |
| testListFiles | Verifies the uploaded file exists in bucket |
| testGenerateSignedUrl | Generates a signed URL for the uploaded file |
| Operation | gcloud Command |
|---|---|
| Create Bucket | gcloud storage buckets create gs://<BUCKET_NAME> --location=me-west1 |
| Upload File | gcloud storage cp test-file.txt gs://<BUCKET_NAME>/ |
| List Files | gcloud storage ls gs://<BUCKET_NAME>/ |
| Generate Signed URL | gcloud storage sign-url --duration=10m gs://<BUCKET_NAME>/test-file.txt |
The project integrates Allure Reports for test execution insights. Reports include:
- Test results (pass/fail)
- Execution time breakdown
- Detailed logs per test
CloudStorageCLI-Testing/
βββ .allure/ # Allure reporting files
βββ .idea/ # IntelliJ project settings
βββ allure-results/ # Allure test results
βββ src/
β βββ main/java/com/cloudstorage/
β β βββ config/ # Configuration class
β β β βββ ProjectConfig.java
β β βββ utils/ # Utility classes
β β β βββ CommandRunner.java
β β β βββ PlaywrightManager.java
β βββ test/java/com/cloudstorage/
β β β βββ tests/
β β β β βββ GCloudStorageTests.java # Tests for gcloud CLI
β β β β βββ PlaywrightSignedURLTest.java # Playwright tests for signed URL security
β β β βββ resources/
β β β β βββtestng.xml # TestNG configuration
βββ target/ # Compiled test results
βββ .gitignore # Git ignore file
βββ phishing_check.png # Screenshot for Playwright test
βββ pom.xml # Maven dependencies
βββ readme.md # Project documentation
βββ test-file.txt # Test file for uploads
βββ
This project is for educational and testing purposes. Modify and use it as needed!
- docker build -t gcloud-tests .
- docker run -it --rm gcloud-tests
- gcloud auth login
- ENTER THE VERIFICATION CODE


