6. Launch test suite without test-script

Artos test project can be executed in multiple different ways

  • Launch project jar using command-line
  • Launch Maven project via command-line
  • Launch Runner via IDE (Eclipse, IntelliJ etc..)

6.1. Launch project jar (Windows command-line)

  • Step 1: Note down Runners fully qualified class-path (Example: com.tests.feature1.FeatureRunner)
  • Step 2: Build Artos test project jar (Example: artos-test-project-0.0.1.jar)
  • Step 3: Create a directory called lib at the location where artos-test-project-0.0.1.jar is situated.
  • Step 4: Copy artos jar downloaded from maven repository inside lib directory.
  • Step 5: Create a directory called conf at the location where artos-test-project-0.0.1.jar is situated.
  • Step 6: Copy artos configuration to conf directory.
  • Step 7: Create a directory called script at the location where artos-test-project-0.0.1.jar is situated.
../_images/Non-Maven_Project_Structure_No_Script.png
  • Step 9: Open command line prompt or PowerShell.
  • Step 10: change directory location to the same directory where artos-test-project-0.0.1.jar is present using cd command.
  • Step 11: Execute below command line argument to execute the Artos test project.
Listing 6.1 Example: Command line to launch test project jar
1
java -cp "artos-test-project-0.0.1.jar;.\lib\artos-0.0.12.jar" com.tests.feature1.FeatureRunner --profile="dev"

Important

  • By default dev profiled configuration is used from framework_configuration.xml file.
  • If a user has separate configurations for dev and production environment OR Window and Linux environments then they should pass appropriate profile name via command-line arguments.

6.2. Launch Maven project as unit test framework

Note

Artos sample project can be downloaded from Artos website.

Below example explains how to launch Artos Maven test project in both the environments (Windows or Linux). Artos sample project POM file is pre-configured to launch Artos test project at compile time like a unit test framework:

  • exec-maven-plugin is used to execute Run_ARTOS.bat for Windows and Run_ARTOS.sh for Linux.
  • exec-maven-plugin is configured to execute script at unit level by setting <phase>test</phase>.
  • <profiles></profiles> feature is used to select correct extension of the files based on platform.

Run_ARTOS.bat and Run_ARTOS.sh script content is specified below.

Listing 6.2 Run_ARTOS.bat content
1
2
3
4
5
@echo off
set mypath=%cd%
@echo %mypath%
mvn exec:java -D"exec.mainClass"="com.tests.FeatureRunner" -Dexec.args="-v -p=dev"
pause
Listing 6.3 Run_ARTOS.sh content
1
2
3
#!/bin/sh
#echo off
mvn exec:java -Dexec.mainClass="com.tests.FeatureRunner" -Dexec.args="-v -p=dev"

6.3. Runner launch using test script (Eclipse IDE)

  • Right-click on Runner. Go to Run As => Run Configurations…
../_images/RunJavaApplication_No_Script.png