Forum Discussion

Yki's avatar
Yki
Contributor
2 years ago

Using readyApi with Github Actions and Maven

I am the only one who is trying to do this? If not please. HELP  How / Where do I set the accesstoken.

 

Why is there no solution to run ReadyAPI with Maven on a headless machine with this "§$&$§" id based license.

I even had a discussion with the AI ChatGPT and to be honest he was a little more useful than the Smartbear Support. At least he gave some weird solutions to what I can try to get my tests running. The support hasn't even answered my question yet.

 

GitHub Actions is installing ReadyApi with each run and tries to run the tests by given the parameter I have in my POM. The only thing which is missing is this authentication.

 

At the moment we are running the tests on Bamboo and there we had the same problem. In the end, the support gave us a filebased license but that is not an option anymore.

 

So is there anybody who is using Maven and figured out where to put the authentication data? I really would appreciate the help.

  •  thank you nmrao  I opened several tickets for various problems I am facing. Instead of answering they released a new version and with chatgpt I was able to solve my issues for now...

     

    KonGres 

    This is how it working for me
    1. POM

     

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>groupId</groupId>
    	<artifactId>flexibill-soapui-tests</artifactId>
    	<version>1.0</version>
    	<packaging>pom</packaging>
    	<name>ReadyApi Project Name</name>
    	<organization>
    		<name>company</name>
    		<url>https://www.google.com</url>
    	</organization>
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	</properties>
    	<repositories>
        </repositories>
    	<pluginRepositories>
    		<pluginRepository>
    			<id>SmartBearPluginRepository</id>
    			<url>https://smartbearsoftware.com/repository/maven2</url>
    		</pluginRepository>
    		<pluginRepository>
    			<id>com.teamdev</id>
    			<url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
    		</pluginRepository>
    	</pluginRepositories>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>com.smartbear</groupId>
    				<artifactId>ready-api-maven-plugin</artifactId>
    				<version>3.46.0</version>
    				<configuration>
    					<!--<globalProperties> <value>preemptive=true</value> </globalProperties> -->
    					<slmAccessKey>your-access-key</slmAccessKey>
    					<projectFile>project_folder</projectFile>
    					<printReport>false</printReport>
    					<outputFolder>${project.build.directory}/readyapi</outputFolder>
    					<junitReport>true</junitReport>
    					<exportAll>true</exportAll>
    					<readyApiProperties>
    						<property>
    							<name>readyapi.logroot</name>
    							<value>${project.build.directory}/readyapi-logs/</value>
    						</property>
    						<property>
    							<name>licenseApiAccessForEveryone</name>
    							<value>true</value>
    						</property>
    					</readyApiProperties>
    					<environment>${env}</environment>
    					<testSuite>${testSuite}</testSuite>
    					<testCase>${testCase}</testCase>
    					<tags>
    						<param>TestCase ${env}</param>
    					</tags>
    					<!-- Only test cases with corresponding tags will be executed -->
    				</configuration>
    				<dependencies>
    					<dependency>
    						<groupId>mysql</groupId>
    						<artifactId>mysql-connector-java</artifactId>
    						<version>8.0.28</version>
    					</dependency>
    					<dependency>
    						<groupId>org.iban4j</groupId>
    						<artifactId>iban4j</artifactId>
    						<version>3.2.1</version>
    					</dependency>
    					<dependency>
    						<groupId>com.smartbear</groupId>
    						<artifactId>ready-api-jdbc-virts</artifactId>
    						<version>3.3.2</version>
    					</dependency>
    				</dependencies>
    				<executions>
    					<execution>
    						<phase>test</phase>
    						<goals>
    							<goal>test</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    	</build>
    </project>

     

     

     2. yaml for Github actions

     

    name: manual_create_testdata
    concurrency: build
    
    on:
      workflow_dispatch:
        inputs:
          environment:
            description: Please specify environment (Integration/Test) for manual run
            required: true
            type: choice
            options:
              - Integration
              - Test
          testsuite:
            description: Please specify testsuite for a specific manual run
            required: false
            type: string
          testcase:
            description: Please specify testcase for a specific manual run e.g.getTodaysDates
            required: false
            type: string
      # schedule:
        # Runs "runs at 5 am every day" (see https://crontab.guru)
        # - cron: '0 5 * * *'
    
    
    jobs:
      build:
    
        runs-on: ubuntu-latest
    
        steps:
    
        - name: Checkout branch
          uses: actions/checkout@v3
    
        - name: Setup Maven Action
          uses: s4u/setup-maven-action@v1.2.1
          with:
            java-version: 17.0
            maven-version: 3.9.0
    
        - name: Install Smartbear
          run: |
            echo "Installing Smartbear API"  
    
            sudo apt-get update -y && sudo apt-get install -y lsb-release software-properties-common && sudo apt-get clean all
            sudo apt-get install wget curl gnupg apt-utils fontconfig jq -y 
            curl https://dl.eviware.com/ready-api/3.46.0/ReadyAPI-x64-3.46.0.sh -o ReadyAPI-x64-3.46.0.sh
            sudo chmod +x ./ReadyAPI-x64-3.46.0.sh
            
    
        - name: Build with Maven
          run: |
            echo "Running Maven build on ${{ github.event.inputs.environment }}"
    
            # Check if both 'testcase' and 'testsuite' are defined
            if [[ -n "${{ github.event.inputs.testcase }}" && -n "${{ github.event.inputs.testsuite }}" ]]; then
              echo "Executing Maven command with testcase and testsuite"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestSuite="${{ github.event.inputs.testsuite }}" -DtestCase="${{ github.event.inputs.testcase }}" -U --file pomGIT.xml
            elif [[ -n "${{ github.event.inputs.testsuite }}" ]]; then
              # If only 'testsuite' is defined
              echo "Executing Maven command with testsuite"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestSuite="${{ github.event.inputs.testsuite }}" -U --file pomGIT.xml
            elif [[ -n "${{ github.event.inputs.testcase }}" ]]; then
              # If only 'testcase' is defined
              echo "Executing Maven command with testcase"
             mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestCase="${{ github.event.inputs.testcase }}" -U --file pomGIT.xml
            else
             # If neither 'testsuite' nor 'testcase' is defined
             echo "Executing Maven command without testsuite and testcase"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -U --file pomGIT.xml
            fi

     

     

  • KonGres's avatar
    KonGres
    New Contributor

    Hello Yki , nope - you're not the only one - I am also looking for some technical support regarding the integration with ReadyAPI and GitHub actions (with pure examples and usage).

  • nmrao's avatar
    nmrao
    Champion Level 3

    What do you mean by Authentication data? more details please?

  • Yki's avatar
    Yki
    Contributor

    Sure nmrao Sorry I am just so frustasted.

    When the run starts Ready API gets installed

        - name: Install Smartbear
          run: |
            echo "Installing Smartbear API"  
    
            sudo apt-get update -y && sudo apt-get install -y lsb-release software-properties-common && sudo apt-get clean all
            sudo apt-get install wget curl gnupg apt-utils fontconfig jq -y 
            curl https://dl.eviware.com/ready-api/3.45.0/ReadyAPI-x64-3.45.0.sh -o ReadyAPI-x64-3.45.0.sh
            sudo chmod +x ./ReadyAPI-x64-3.45.0.sh
            sudo /bin/sh ReadyAPI-x64-3.45.0.sh -q -username "email-address" -accessKey "real-access-key-1234"
    

     and no matter whether I use

    username + password

    username + accesskey

    only acceskey

    as soon as tests are about to run, ready api is shut down because he cannot find a valid license.

    The license is valid btw.

    We have the same problem on Bamboo so we got a key-file but this is not an option for the future

  • Yki's avatar
    Yki
    Contributor

    When the job starts with installing ReadyAPI

    Afterwards the testing should begin but it doesn't because the license cannot be found. And I need to know where I have to add these license information. The logfile is asking for a file, but with switching to id_based license, there is no key anymore.

    What I have tried so far using

    - email + password

    - email + token

    - token

     

    I also tried to use and env-variable
    READYAPI_USERNAME and READYAPI_PASSWORD but that does also not work.

    jobs:
      build:
    
        runs-on: ubuntu-latest
        
    
        steps:
    
        - uses: actions/checkout@v3
    
        - name: Setup Maven Action
          uses: s4u/setup-maven-action@v1.2.1
          with:
            java-version: 17.0
            maven-version: 3.9.0
    
        - name: Install Smartbear
          run: |
            echo "Installing Smartbear API"  
    
            sudo apt-get update -y && sudo apt-get install -y lsb-release software-properties-common && sudo apt-get clean all
            sudo apt-get install wget curl gnupg apt-utils fontconfig jq -y 
            curl https://dl.eviware.com/ready-api/3.45.0/ReadyAPI-x64-3.45.0.sh -o ReadyAPI-x64-3.45.0.sh
            sudo chmod +x ./ReadyAPI-x64-3.45.0.sh
            sudo /bin/sh ReadyAPI-x64-3.45.0.sh -q -username "my@email.de" -accessKey "real-token-1234"


     

  • Yki's avatar
    Yki
    Contributor

    Are my answers getting deleted? I answerd twice now and they keep disappearing =/

    So third try

    Github Actions starts Ubuntu Server

    Github Actions installs Ready Api

    Git hub Actions use Pom.xml to run tests

    Tests doesn't start because ReadyApi doesn't find a valid license.

     

    Where do I have to put credentials to make the tests running

  • nmrao's avatar
    nmrao
    Champion Level 3

    Not familiar with it.

    Have you copied the license file?

    Try to see by adding below if it helps

    -a "username:password" -L /path/to/license/file
  • Yki's avatar
    Yki
    Contributor

    Hey Rao,

    thank you for taking your time to help me.

     

    Yes I also copied the key-file into the bin folder of Ready API but that doesn't help.

    Where should I add your command and you have either name + password OR a keyfile or I am totally mistaken now. 

    Seriously it is driving me nuts, why Smartbear can't just provide a working example, of answer on tickets for that matter ^^

  • nmrao's avatar
    nmrao
    Champion Level 3

    Thanks for trying.

    May be you should open a ticket with customer support, so that it would be faster to address your issue.

  • Yki's avatar
    Yki
    Contributor

     thank you nmrao  I opened several tickets for various problems I am facing. Instead of answering they released a new version and with chatgpt I was able to solve my issues for now...

     

    KonGres 

    This is how it working for me
    1. POM

     

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    	<modelVersion>4.0.0</modelVersion>
    	<groupId>groupId</groupId>
    	<artifactId>flexibill-soapui-tests</artifactId>
    	<version>1.0</version>
    	<packaging>pom</packaging>
    	<name>ReadyApi Project Name</name>
    	<organization>
    		<name>company</name>
    		<url>https://www.google.com</url>
    	</organization>
    	<properties>
    		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    	</properties>
    	<repositories>
        </repositories>
    	<pluginRepositories>
    		<pluginRepository>
    			<id>SmartBearPluginRepository</id>
    			<url>https://smartbearsoftware.com/repository/maven2</url>
    		</pluginRepository>
    		<pluginRepository>
    			<id>com.teamdev</id>
    			<url>https://europe-maven.pkg.dev/jxbrowser/releases</url>
    		</pluginRepository>
    	</pluginRepositories>
    	<build>
    		<plugins>
    			<plugin>
    				<groupId>com.smartbear</groupId>
    				<artifactId>ready-api-maven-plugin</artifactId>
    				<version>3.46.0</version>
    				<configuration>
    					<!--<globalProperties> <value>preemptive=true</value> </globalProperties> -->
    					<slmAccessKey>your-access-key</slmAccessKey>
    					<projectFile>project_folder</projectFile>
    					<printReport>false</printReport>
    					<outputFolder>${project.build.directory}/readyapi</outputFolder>
    					<junitReport>true</junitReport>
    					<exportAll>true</exportAll>
    					<readyApiProperties>
    						<property>
    							<name>readyapi.logroot</name>
    							<value>${project.build.directory}/readyapi-logs/</value>
    						</property>
    						<property>
    							<name>licenseApiAccessForEveryone</name>
    							<value>true</value>
    						</property>
    					</readyApiProperties>
    					<environment>${env}</environment>
    					<testSuite>${testSuite}</testSuite>
    					<testCase>${testCase}</testCase>
    					<tags>
    						<param>TestCase ${env}</param>
    					</tags>
    					<!-- Only test cases with corresponding tags will be executed -->
    				</configuration>
    				<dependencies>
    					<dependency>
    						<groupId>mysql</groupId>
    						<artifactId>mysql-connector-java</artifactId>
    						<version>8.0.28</version>
    					</dependency>
    					<dependency>
    						<groupId>org.iban4j</groupId>
    						<artifactId>iban4j</artifactId>
    						<version>3.2.1</version>
    					</dependency>
    					<dependency>
    						<groupId>com.smartbear</groupId>
    						<artifactId>ready-api-jdbc-virts</artifactId>
    						<version>3.3.2</version>
    					</dependency>
    				</dependencies>
    				<executions>
    					<execution>
    						<phase>test</phase>
    						<goals>
    							<goal>test</goal>
    						</goals>
    					</execution>
    				</executions>
    			</plugin>
    		</plugins>
    	</build>
    </project>

     

     

     2. yaml for Github actions

     

    name: manual_create_testdata
    concurrency: build
    
    on:
      workflow_dispatch:
        inputs:
          environment:
            description: Please specify environment (Integration/Test) for manual run
            required: true
            type: choice
            options:
              - Integration
              - Test
          testsuite:
            description: Please specify testsuite for a specific manual run
            required: false
            type: string
          testcase:
            description: Please specify testcase for a specific manual run e.g.getTodaysDates
            required: false
            type: string
      # schedule:
        # Runs "runs at 5 am every day" (see https://crontab.guru)
        # - cron: '0 5 * * *'
    
    
    jobs:
      build:
    
        runs-on: ubuntu-latest
    
        steps:
    
        - name: Checkout branch
          uses: actions/checkout@v3
    
        - name: Setup Maven Action
          uses: s4u/setup-maven-action@v1.2.1
          with:
            java-version: 17.0
            maven-version: 3.9.0
    
        - name: Install Smartbear
          run: |
            echo "Installing Smartbear API"  
    
            sudo apt-get update -y && sudo apt-get install -y lsb-release software-properties-common && sudo apt-get clean all
            sudo apt-get install wget curl gnupg apt-utils fontconfig jq -y 
            curl https://dl.eviware.com/ready-api/3.46.0/ReadyAPI-x64-3.46.0.sh -o ReadyAPI-x64-3.46.0.sh
            sudo chmod +x ./ReadyAPI-x64-3.46.0.sh
            
    
        - name: Build with Maven
          run: |
            echo "Running Maven build on ${{ github.event.inputs.environment }}"
    
            # Check if both 'testcase' and 'testsuite' are defined
            if [[ -n "${{ github.event.inputs.testcase }}" && -n "${{ github.event.inputs.testsuite }}" ]]; then
              echo "Executing Maven command with testcase and testsuite"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestSuite="${{ github.event.inputs.testsuite }}" -DtestCase="${{ github.event.inputs.testcase }}" -U --file pomGIT.xml
            elif [[ -n "${{ github.event.inputs.testsuite }}" ]]; then
              # If only 'testsuite' is defined
              echo "Executing Maven command with testsuite"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestSuite="${{ github.event.inputs.testsuite }}" -U --file pomGIT.xml
            elif [[ -n "${{ github.event.inputs.testcase }}" ]]; then
              # If only 'testcase' is defined
              echo "Executing Maven command with testcase"
             mvn clean test -Denv="${{ github.event.inputs.environment }}" -DtestCase="${{ github.event.inputs.testcase }}" -U --file pomGIT.xml
            else
             # If neither 'testsuite' nor 'testcase' is defined
             echo "Executing Maven command without testsuite and testcase"
              mvn clean test -Denv="${{ github.event.inputs.environment }}" -U --file pomGIT.xml
            fi

     

     

  • Yki's avatar
    Yki
    Contributor

    I have tags on all my test cases. Most can of them run on all environments but not all of them ^^