ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Using ANT test runner and passing user defined variables

book

Article ID: 200618

calendar_today

Updated On:

Products

CA Cloud Test Mobile CA Application Test

Issue/Introduction

Ok, this one is related to passing variable information starting from outside of Lisa entirely, all the way into using it in a test, or suite of tests.

The development of our systems is picking up pace, and now we have multiple hosting environments coming online.  We need to be able to programmatically pass which host to send the testing traffic to, as now we have more than one setup.

Currently, all of our tests are hardcoded with our development hostname, and now we would like to make our tests be able to be called with something like http://{{endpoint}}/blah/blah.

Our pipeline that calls the Lisa tests suite does so with ANT.  I was unsuccessful at trying to pass an environment variable through the ANT call and use it in Lisa, and I would like to know how this can be done, if at all.  Which, we think it can, we're just not sure how.

I reviewed this documentation but did not find an example for ANT called variable passing.  https://techdocs.broadcom.com/us/en/ca-enterprise-software/devops/devtest-solutions/10-5/using/using-application-test/using-devtest-workstation-with-application-test/building-test-cases/properties/property-sources.html


I will attach our current ANT test runner scripts so you can study them if you want.

And I'm almost certain a webex will be needed to give a much clearer picture of what we're trying to do.

Environment

Release : 10.5

Component : CA Service Virtualization

Resolution

Had a look at it and was able to spot that a config variable needed a simple folder name prefix added to it.



Our solution now looks something like this.

<target name='run-junit-suite' depends='clean' description='run a test suite' >

              <junitlisa lisahome='${env.LISA_HOME}' toDir='${report.dir}' printsummary='true'  showoutput='true' user='${env.LISA_USER}' password='${env.LISA_PASSWORD}' registry='${env.LISA_REGISTRY}' config='${basedir}/Configs/${env.LISA_CONFIG}'>

             <lisatest suite='${test.suite}'/>

              </junitlisa>

              <junitlisareport toDir='${report.dir}'/>

       </target>

 


The missing ingredient is that when specifying a config… It’s not the name as it appears in Lisa. It’s the full file path to the file.config as it exists on the file system.



So in the Lisa project folder there would be a Configs directory, and to use QA, I would set LISA_CONFIG=qa.config as an environment variable.



I hope this helps you guys as it was not terribly obvious in the product documentation, but this was it.