Menu

Automation Host Docker Setup Instructions

In this article, we will walk you through how to setup the automation host in Docker environment on Ubuntu machine.

1. Create a Dockerfile at /path/to/agentctl/Dockerfile,  enter content as below:

FROM ubuntu:16.04
RUN apt-get update &&apt-get install -y git curl wget && rm -rf /var/lib/apt/lists/* ENV AGENT_VERSION $TheAgentHostVersion ENV PACKAGE_NAME agentctl-${AGENT_VERSION}-linux-x64-full.tgz ENV PACKAGE_URL https://s3.amazonaws.com/qtest-storage/qtest-automation/${AGENT_VERSION}/$PACKAGE_NAME ENV AGENT_HOME /usr/local
ENV FOLDER_NAME agentctl-${AGENT_VERSION} ENV PORT 6789 WORKDIR $AGENT_HOME RUN set -x \ && wget --no-check-certificate "$PACKAGE_URL" \ && tar xvzf $PACKAGE_NAME -C $AGENT_HOME \ && rm $PACKAGE_NAME \ && mv agentctl-${AGENT_VERSION} agentctl # install a junit sample COPY ./junit-sample ${AGENT_HOME}/junit-sample/ # configure host RUN ./agentctl/agentctl config -Phost=0.0.0.0 -Pport=${PORT} EXPOSE $PORT COPY ./entrypoint.sh /entrypoint.sh RUN chmod u+wrx /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]

Note:

  • $TheAgentHostVersion: replace this value with the automation host version you want to install, e.g. 2.0.5
  • This example install junit sample code to demo junit for java plugin, you can download junit-sample to working folder (~/agent) and follow guide to build the sample in this repository: https://github.com/QASymphony/junit-sample
    # install a junit sample
    COPY ./junit-sample ${AGENT_HOME}/junit-sample
    

2. Create a file called entrypoint.sh and make it executable

Open entrypoint.sh in your favorite text editor and enter content as below:

#!/usr/bin/env bash
./agentctl/agentctl start

3. Build the image:

docker build -t agent:new .

docker-build.png

Once the docker build command is successful, you'll see the output like below:

docker-build-success.png

4. Run the container with the desired port:

$ docker run -d -p 8080:6789 agent:new

docker-run.png

When this command finished, wait for a couple of minutes for the automation host to be fully started.

5. Register the automation host with qTest Manager

Open web browser and access to the host via this url: http://[host-ip-address]:8080. You will be presented with a UI like below.

configure-host.png

On the host UI, enter the following to register the automation host with qTest Manager:

  • Host Name: name of the automation host
  • qTest URL: URL of you qTest Manager instance
  • Full Name: your full name
  • qTest Token: the API token for the host to access to qTest Manager. Follow these instructions to get the API token
  • If your environment is behind proxy, click on Configure Proxy link and provide proxy configuration
  • Click Register button

When the registration is successfully, you'll be presented with the automation host home page.

register-host-successfully.png

6. Create JUnit sample agent

Click Add button.

add-agent.png

On the New Agent dialog, enter the information for the new agent.

General Information

  • Agent Name: Name of the new egent, e.g. junit demo
  • qTest Manager Project: select a project that this Agent is associated with, e.g. qConnect Sample Project
  • Agent Type: JUnit for Java

Test Scripts

  • Directory: specify the path to your JUnit source code that you have downloaded. In this example, it's /usr/local/junit-sample
  • Scripting libs (optional): /usr/local/junit-sample/libs
  • Include (required): **/*.class
  • Exclude: leave this field empty

Execution

  • Execution Mode: Command
  • Executable home: /docker-java-home
  • Command: java
  • Command arguments: -cp “/usr/local/junit-sample/target/*” 

Refer to these user guides for more detail on how to create various type of agents to your automation host.

configure-junit-agent.png

Click Save & Scan button. The automation host will create your agent and scan for test cases. When the scanning complete, you'll be presented with the Automation Test Case Mapping Wizard dialog as below screenshot.

test-cases-mapping.png

Select test cases then click Create to create test cases in qTest Manager.

You have completed setup automation host on Docker environment.

 

 

 

Powered by Zendesk