You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

For python integration in automatics 2 jobs should be created for the below functionalities

  1. First job is to create Automatrics python Library for test execution - During automatics test execution this Library will be invoked from automatics for executing python scripts
  2. Second job is the test execution job for python which needs some addition configuration when compared to the test execution job for JAVA

Automatics Python Library creation job

Please follow the below steps to create Automatics Python Library and distribute across jenkins VM from Jenkins job

1.Creating Jenkins job


  • From Jenkins, select “New Item”,
  • Specify name of the new job to be created.
  • Select ‘OK’ button.

2. Configuration of Jenkins Job

Configure General Settings

  • In ‘General’ settings, add proper description in the ‘Description’ section
  • Check ‘Discard old builds’ checkbox

Configure Source Code Management

  • In ‘Source Code Management’, select git and under ‘Repository’ add the repo detail of Automatics Python wrapper Library project

 eg : ‘https://code.rdkcentral.com/r/rdk/tools/automatics’ and also add the repo credentials

  • Also add the branch of the repository in ‘Branches to build’

    eg : */rdk-python

Configure Build Triggers

  • In build triggers section select ‘Poll SCM’ and enter the schedule. By this configuration, there will be a polling to the repo for any changes periodically and if there are any changes then the Jenkins build will be executed

    Eg : @hourly means the job will check for any changes in the remote repo for every 1 hour and if there are any changes, then the build will run

Configure Build Environment

  • In ‘Build Environment’, select ‘Delete workspace before build starts’

Configure Build Settings

  • In the ‘Build’ settings, Click on ‘Add build step’ and Select 'Execute Shell'
  • Add the following commands in the text box
    • Configure Build Setting
      #/bin/sh
      
      python3 setup.py bdist_wheel
      
      python3 setup.py sdist
      
      pip3 install --upgrade -e .

Save the Configuration

  • Click on ‘Apply’ and ‘Save’


Automatics Python Test Execution Job

The job creation for test execution can be done using the steps available in the page Jenkins Job for Test Execution . Only change is in the Jenkins Job for Test Execution#ConfigureBuild section. The changes are as follows 

  • In configuring shell script for partner java dependency the below commands should be added additionally
    • This code will create a new folder called "automaticsPythonTest" in your jenkins job workspace and clone your Python Test scripts to this location

      Execute shell in Configure Build
      mkdir /var/lib/jenkins/workspace/$BUILD_JOB_NAME/automaticsPythonTest
      
      cd /var/lib/jenkins/workspace/$BUILD_JOB_NAME/automaticsPythonTest
      
      # specify the repository URL of python script
      repo_url="<YOUR_PYTHON_TESTCASE_GIT_REPO_URL>"
      
      # specify the target directory for cloning
      target_dir="/var/lib/jenkins/workspace/$BUILD_JOB_NAME/automaticsPythonTest"
      
      # specify the branch name
      branch_name="<YOUR_PYTHON_TESTCASE_GIT_REPO_BRANCH>"
      
      # clone the repository
      git clone --branch $branch_name $repo_url $target_dir
      
      # change to the target directory
      cd $target_dir

      So the final Execute shell script will look somewhat like below


Once point also to note here is you need to use the newly available pre-test-config.sh also in this job, this is to add the maven shade plugin dependency to the pom.xml to create an executable jar. This executable jar is required to communicate from python scripts to java in order to access the already available APIs in automatics Core and utils

  • No labels