Automating Unit Testing in Actions

Questions and Answers on installation, deployment, management, locking, tranasactions of Servoy Application Server

Automating Unit Testing in Actions

Postby eros » Fri Mar 01, 2024 6:12 pm

Hi all,

I've been looking at the documentation, but haven't been able to find an answer to this.

I've been able to setup the build and deploy of my servoy titanium application using github actions. It creates the war file and creates and containerizes it before deploying to aws, but I would like it to run all unit testing during this process and post the results.

I am currently using the war_export.sh to generate the war file. Is there a parameter that can be added to this command to run unit testing? Is there a different command altogether? Is this only possible via ANT? Any help would be appreciated.

some additional info, my current solution is called CRM and it has a number of modules. We have another solution called UnitTesting that is separate of the CRM solution, but it includes the CRM solution and other modules that it tests. I've added the UnitTesting solution as an additional solution that gets build with my application, and I do see it as one of the solutions in servoy-admin solutions page.
eros
 
Posts: 3
Joined: Wed Oct 04, 2017 5:27 pm

Re: Automating Unit Testing in Actions

Postby eros » Fri Mar 29, 2024 2:35 am

No one replied here, but I figured it out still. I had to use ANT, and used a couple older links for reference: https://wiki.servoy.com/display/Serv7/Using+Jenkins+As+Continuous+Build+Software and https://wiki.servoy.com/display/Serv7/Automated+Testing+Guide

Anyways, here is an example of the build yaml file for unit testing:

Code: Select all
name: Unit Testing

on:
  push:
    branches:
      - dev
     
jobs:
  ant-build-and-test:
    runs-on: self-hosted
    environment: dev
    steps:
    - uses: actions/checkout@v2

    # Setup Node.js
    - name: Setup Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '14'

    # Setup Java
    - name: Setup Java JDK
      uses: actions/setup-java@v2
      with:
        java-version: '17'
        distribution: 'temurin'

    # Setup ANT Contrib
    - name: Download and Setup files
      run: |
        mkdir -p ${{ github.workspace }}/lib
        curl -L -o ${{ github.workspace }}/lib/ant-contrib-1.0b3.jar https://repo1.maven.org/maven2/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar
        curl -L -o ${{ github.workspace }}/lib/servlet-api.jar https://repo1.maven.org/maven2/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.jar   
   
    # Start Xvfb
    - name: Start Xvfb
      run: |
        sudo Xvfb :99 -ac -screen 0 1280x1024x24 &
        echo "DISPLAY=:99" >> $GITHUB_ENV 

    # Run ANT Build
    - name: Run ANT Targets
      run: |
        ant -lib ${{ github.workspace }}/lib/servlet-api.jar -f antRunner/jenkins_build.xml \
          -Dservoy.developer.dir=/opt/servoy/developer \
          -Dwork.servoy.install.dir=/opt/servoy \
          -Dwork.servoy.install.url=http://localhost:8183 \
          -Dsmart_test_solutions=Unit_Test \
          -Dtest.timeout=900000 \
          -Djava.awt.headless=true \
          -Dservoy.test.property.file=/application_server/servoy.properties \
          -DWORKSPACE=${{ github.workspace }} \
          -DANT_CONTRIB_JAR=${{ github.workspace }}/lib/ant-contrib-1.0b3.jar main_smart

    - name: Send Email With Attachment
      if: always()
      run: Code To Send Email Goes Here
eros
 
Posts: 3
Joined: Wed Oct 04, 2017 5:27 pm


Return to Servoy Server

Who is online

Users browsing this forum: No registered users and 17 guests

cron