Points to Remember
Last updated
Was this helpful?
Last updated
Was this helpful?
To run automation through intellij/IDE one should need to create a configuration in intellij
Main Class:
in.precisiontestautomation.runner.ScriptlessApplication
The entry point of the automation process.
CLI Arguments: true
true
specifies execution through Maven and false
specifies not executing through maven.
While setting up configuration on IDE keep CLI Arguments asfalse
. This configuration tell the framework that it got triggered by IDE.
true: it indicates that the automation was initiated by Maven. In this scenario, the automation process first generates a TestNG file in the target folder, which then needs to be manually triggered to run the tests
false: it signifies that the automation was started from an Integrated Development Environment (IDE). Here, the automation process directly executes the test cases and subsequently creates a TestNG file in the target folder upon completion of the test execution.
The below configuration should be added to the pom of the project:
<build>
<sourceDirectory>/src/main</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<compilerArgument>-parameters</compilerArgument>
<parameters>true</parameters>
<testCompilerArgument>-parameters</testCompilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>in.precisiontestautomation.runner.ScriptlessApplication</mainClass>
<arguments>
<argument>true</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<argLine>-XX:+ExplicitGInvokesConcurrent</argLine>
<argLine>--add-opens java.base/java.lang.reflect=ALL-UNNAMED</argLine>
<testFailureIgnore>false</testFailureIgnore>
<suiteXmlFiles>
<suiteXmlFile>target/testngenerator.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
maven command to execute automation through terminal using maven command
mvn clean exec:java test
mvn -> This is the command line invocation of Maven
clean -> This is a Maven phase that belongs to the 'clean' lifecycle. When you run mvn clean
, it removes the files in the project's target
directory (the default build directory in Maven)
exec:java -> This is a goal from the exec-maven-plugin
. The exec:java
goal is used to execute a Java class in the current project with the specified main class and arguments
test -> The mvn test command is part of Maven's 'test' lifecycle phase. Executing this command activates TestNG tests specified under the maven-surefire-plugin in the project's pom.xml file.
Our test automation framework employs a structured naming convention for test cases to ensure clarity and easy traceability. Each test case file is named following the format: "TestCaseId_GroupName.csv".
Components of the Naming Convention
TestCaseId:
Description: This is the unique identifier for the test case, as recorded in our test management tool.
Purpose: Helps in tracing the automated test back to its corresponding test case in the test management system for reference and reporting.
GroupName:
Description: Indicates the test group or category to which the test case belongs. Common groups include 'sanity', 'smoke', and 'regression'.
Purpose: Facilitates organizing and selecting test cases based on testing phases or objectives.
File Format
.csv: The test cases are saved in CSV (Comma-Separated Values) format, which allows for easy editing and readability.
.feature: The test cases are saved in Gherkin syntax, which allows for easy editing and readability. This format defines test cases in a natural language style (e.g., "Given-When-Then"), making it accessible to both technical and non-technical stakeholders.
Examples
101_sanity.csv: A test case with ID 101, designated for the sanity test suite.
204_regression.csv: A test case with ID 204, meant for regression testing.
301_sanity.feature: A test case with ID 301, written in Gherkin syntax, designated for the sanity test suite.