Sign inSign up

provartesting/ant-cli

By provartesting

•Updated about 1 month ago

Provar ANT CLI is used to execute provar tests using ant.

Image
1

2.5K

provartesting/ant-cli repository overview

⁠Public Docker Image for Provar, hosted on Docker Hub.

  • Purpose: To provide a pre-configured environment for running Provar tests with essential software and dependencies.

  • Included Components:

    • Provar ANT CLI
    • Java 21
    • Apache Ant
    • Chrome and Firefox browsers
  • Prerequisites:

    • Provar project in a source control repository
    • Required licenses and optional SMTP configuration
    • build.xml file
    • Recommended CI job setup
    • Optional proxy configuration
  • Usage:

    1. Choose Provar Image with a particular tag.
    2. Create a Dockerfile in your project directory.
    3. Define the Dockerfile with base image, configurations, and dependencies.

Example Dockerfile:

# Specify Provar base image version
ARG PROVAR_VERSION

FROM provartesting/ant-cli:${PROVAR_VERSION}

# Define environment variables
ARG PROJECT_NAME=ProvarProject
ARG ProjectHome
ARG Browser
ARG BUILD_FILE
ARG BuildFolder
ARG ENVR
ARG ANT_TARGET=runtests
ARG TEST_PLAN
ARG ProvarSecretsPassword
ARG PROVAR_sf_Admin
ARG PROVAR_sf_Admin_password
ENV ProjectPath=/home/${PROJECT_NAME} \
    ProjectHome=${ProjectHome} \
    Browser=${Browser} \
    BuildFileName=${BuildFileName} \
    BuildFolder=${BuildFolder} \
    ANT_TARGET=${ANT_TARGET} \
    ProvarSecretsPassword=${ProvarSecretsPassword} \
    DISPLAY=:99.0 \
    JAVA_ARGS=-verbose:class \
    PROVAR_AUTORETRY_TIMEOUT=30 \
    PROVAR_AUTORETRY_OVERRIDE=ENABLE_ALL \
    PROVAR_EXECUTION_MODE=Docker

# Copy Provar project and resources
COPY . ${ProjectPath}
COPY License* ${PROVAR_HOME}/.licenses/
COPY smtp1.config ${PROVAR_HOME}/.smtp/

# Set the working directory
WORKDIR ${ProjectPath}

# Define entrypoint for Provar execution
RUN echo "#!/bin/sh \n env \n xvfb-run ant -Dtestcycle.path=${ProjectHome}/TestCycle/ -Dtestproject.results=${ProjectHome}/Results/ -Dprovar.home=${PROVAR_HOME} -Dsecrets.password=${ProvarSecretsPassword} -Dtestenvironment.secretspassword=${ProvarSecretsPassword} -Dbrowser=${Browser} -Denvr=${ENVR} -Dtestproject.home=${ProjectPath}/${ProjectHome} -f ${ProjectPath}/${ProjectHome}/${BuildFolder}/${BuildFileName} ${ANT_TARGET}" > ./entrypoint.sh
RUN chmod +x ./entrypoint.sh

ENTRYPOINT ["./entrypoint.sh"]
CMD
  • Build Arguments:
    • Build arguments are defined in the Dockerfile using the ARG instruction.
    • They can be set during the Docker build process using the --build-arg flag.
  • Defined Build Arguments:
    • PROVAR_VERSION: Determines the Provar base image version or tag.
    • PROJECT_NAME: Name of the project created inside the container (default: ProvarProject).
    • ProjectHome: The project's home directory.
    • Browser: Name of the browser (e.g., Chrome, Chrome_Headless, Firefox).
    • BUILD_FILE: Name of the build file for running tests.
    • BuildFolder: Name of the folder where the build file is located.
    • ANT_TARGET: Specifies the ANT target defined in the build file.
    • ENVR: Environment under test.
    • TEST_PLAN: Test Plan to target in the build file.
    • ProvarSecretsPassword: Secret password for encrypted Provar projects.
    • PROVAR_sf_Admin: Salesforce Connection Name.
    • PROVAR_sf_Admin_password: Salesforce Connection Password.
    • PROVAR_EXECUTION_MODE: Execution mode (e.g., Docker).
  • Additional Parameters:
    • PROVAR_AUTORETRY_TIMEOUT: Timeout for auto-retry.
    • PROVAR_AUTORETRY_OVERRIDE: Auto-retry setting (e.g., ENABLE_ALL).
  • ChromeOptions:
    • Add "--disable-dev-shm-usage" in the project to prevent Chrome failures in certain VM environments.
  • Proxy Configuration:
    • Configure proxy settings within the Dockerfile, including options like port, host, type, user, and password.
  • Handling Secret Encryption:
    • Define the ProvarSecretsPassword environment variable in the Dockerfile.
    • Override the value using this environment variable in the ANT command.
    • Use credential manager to define the secret value in the Jenkins file.
  • Parallel Execution:
    • Execute tests in parallel:
      • Trigger multiple CI jobs to run tests in multiple containers simultaneously.
      • Use the ANT parallel tag in the build.xml file to define multiple targets and thread counts.
  • Execution with Test-Cycle:
    • For using Provar test cycles, pass the cycle path in the Dockerfile ANT command.
    • Enable Slack reporting for test cycles, specifying the channel, credential, file path, and initial comment.

⁠CI Pipeline Integration:

  • Step 1: Check out code from the source control repository.
  • Step 2: Build a Docker image using the Dockerfile, including build arguments using the --build-arg flag.
docker build \
  --build-arg PROVAR_VERSION=$PROVAR_VERSION \
  --build-arg ProjectHome=$ProjectHome \
  --build-arg Browser=$Browser \
  --build-arg ENVR=$ENVR \
  --build-arg BuildFileName=$BuildFileName \
  --build-arg BuildFolder=$BuildFolder \
  --build-arg ANT_TARGET=$ANT_TARGET \
  -t <your-image-name>:<tag> .
  • Step 3: Execute the Docker container for test execution and retrieve results using volume mapping.
docker run --rm -i -v ${WORKSPACE}/Results:/home/ProvarProject/${ProjectHome}/Results/ --name provartests <your-image-name>:<tag>
  • Step 4: Notify the team with the test report through Slack or email.

Tag summary

Content type

Image

Digest

sha256:783bba993…

Size

1 GB

Last updated

about 1 month ago

docker pull provartesting/ant-cli