Tools & Technologies
Category |
Tool/Tech |
CI/CD Orchestration |
Jenkins |
Version Control |
Git (GitHub/GitLab) |
Build Tool |
Maven |
Test Framework |
TestNG |
Automation Tool |
Selenium WebDriver |
Reporting |
Allure Reports |
Containerization |
Docker (optional) |
CI/CD Pipeline Flow
The CI/CD pipeline typically includes the following stages:
1. Code Commit
2. Jenkins Trigger
3. Checkout Code
4. Build with Maven
5. Run TestNG Tests
6. Generate Allure Reports
7. Archive Artifacts
8. Deploy to Staging/Prod
Sample TestNG Test (Java)
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SampleTest {
   @Test
   public void openGoogle() {
       WebDriver driver = new ChromeDriver();
       driver.get("https://www.google.com");
       assert driver.getTitle().contains("Google");
       driver.quit();
   }
}
Maven pom.xml Snippet
<build>
   <plugins>
       <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
           <version>3.0.0</version>
           <configuration>
               <suiteXmlFiles>
                   <suiteXmlFile>testng.xml</suiteXmlFile>
               </suiteXmlFiles>
           </configuration>
       </plugin>
   </plugins>
</build>
Jenkins Pipeline (Declarative)
pipeline {
   agent any
   tools {
       maven 'Maven 3.8.1'
       jdk 'JDK 11'
   }
   stages {
       stage('Checkout') {
           steps {
               git 'https://github.com/your-repo/automation-tests.git'
           }
       }
       stage('Build') {
           steps {
               sh 'mvn clean install'
           }
       }
       stage('Test') {
           steps {
               sh 'mvn test'
           }
       }
       stage('Allure Report') {
           steps {
               allure includeProperties: false, jdk: '', results: [[path: 'target/allure-results']]
           }
       }
       stage('Archive Artifacts') {
           steps {
               archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
           }
       }
   }
   post {
       always {
           junit 'target/surefire-reports/*.xml'
       }
   }
}
Best Practices
- Fail Fast: Run unit tests early to catch issues quickly.
- Parallel Testing: Use Selenium Grid or cloud services to speed up execution.
- Environment Isolation: Use Docker containers for consistent test environments.
- Versioned Artifacts: Store builds in Nexus or Artifactory for traceability.
- Notifications: Integrate Slack, Teams, or email for build/test alerts.