Service Virtualization

Expand all | Collapse all

Pass Jenkins Parameters to DevTest

  • 1.  Pass Jenkins Parameters to DevTest

    Posted Jul 20, 2017 02:48 PM

    I have 2 Jenkins jobs on server, I want to pass the output parameters from Job 1 to DevTest test cases on Job 2. we don't want to use Excel sheet to pass data for Job 2.  



  • 2.  Re: Pass Jenkins Parameters to DevTest

    Broadcom Employee
    Posted Jul 27, 2017 03:25 PM

    Con I can some more details about this?

     

    1. What version of DevTest are you on?

    2. What is the output you are wanting to pass from job 1 to job 2?



  • 3.  Re: Pass Jenkins Parameters to DevTest

    Posted Jul 28, 2017 10:43 AM

    I am using DevTest 10.1, Out put from Job 1 is like store no and date



  • 4.  Re: Pass Jenkins Parameters to DevTest

    Posted Jul 27, 2017 07:21 PM

    You might see if this post helps out.  Passing data to a test via lisa-invoke  On the basis of linked post, your Job 2 might need a little extra code to get/set the values as props if you are passing more than a single property value. 



  • 5.  Re: Pass Jenkins Parameters to DevTest

    Posted Jul 28, 2017 06:43 AM

    Jagadish,

     

    Did the Passing data to a test via lisa-invoke post help you out with this issue?



  • 6.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 01, 2017 07:49 AM

    You can use jvm arguments while running ur devtest script in job 2. 

     

    Testrunner ......... -DSTORE_NO=outputfromjob1

     

    You can now access STORE_NO as a property in ur test case 2. 



  • 7.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 01, 2017 11:29 AM

    I tried this <jvmarg value="-Dstr_nbr=str_nbr"/> in my build xml and using str_nbr as a property in my test case. the value did not pass to test case



  • 8.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 01, 2017 11:41 AM

    Do you see any value being populated? looks like you are using ANT.

     

    can you try this 

    <jvmarg value="-Dstr_nbr=${str_nbr}"/>



  • 9.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 01, 2017 12:53 PM

    Yes I am using ANT and I can see those values in console something like this . Tried ${str_nbr} too, 

    -Dstr_nbr=9773


  • 10.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 02, 2017 10:14 AM

    I have jenkins and ANT on windows machine and Devtest registry on docker container( linux). Will this be an issue? should we have all 3 on the same machine to pass the values?



  • 11.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 02, 2017 10:40 AM

    I dont think so. Did you try to print the {{str_nbr}} value in second test case?



  • 12.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 02, 2017 11:35 AM

    Error: The password is correct, the parameters from Jenkins were not passed to the test case.

    | Message:     [jcc][t4][10205][11235][4.18.60] Null password is not supported. ERRORCODE=-4461, SQLSTATE=42815 [junitlisa] ---------------------------------------------------------------------------- [junitlisa] | Trapped Exception: [jcc][t4][10205][11235][4.18.60] Null password is not supported. ERRORCODE=-4461, SQLSTATE=42815 [junitlisa] | Trapped Message:   com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10205][11235][4.18.60] Null password is not supported. ERRORCODE=-4461, SQLSTATE=42815 [junitlisa] ---------------------------------------------------------------------------- [junitlisa] STACK TRACE [junitlisa] com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][t4][10205][11235][4.18.60] Null password is not supported. ERRORCODE=-4461, SQLSTATE=42815 [junitlisa]      at com.ibm.db2.jcc.am.kd.a(kd.java:747) [junitlisa]      at com.ibm.db2.jcc.am.kd.a(kd.java:66) [junitlisa]      at com.ibm.db2.jcc.am.kd.a(kd.java:111) [junitlisa]      at com.ibm.db2.jcc.t4.b.a(b.java:2382) [junitlisa]      at com.ibm.db2.jcc.t4.b.b(b.java:809) [junitlisa]      at com.ibm.db2.jcc.t4.b.a(b.java:781) [junitlisa]      at com.ibm.db2.jcc.t4.b.a(b.java:424) [junitlisa]      at com.ibm.db2.jcc.t4.b.a(b.java:397) [junitlisa]      at com.ibm.db2.jcc.t4.b.<init>(b.java:335) [junitlisa]      at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:233) [junitlisa]      at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:199) [junitlisa]      at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:474) [junitlisa]      at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:115) [junitlisa]      at com.itko.lisa.jdbc.JDBCDriverConnectionAsset.createInstance(JDBCDriverConnectionAsset.java:218) [junitlisa]      at com.itko.lisa.jdbc.JDBCDriverConnectionAsset.createInstance(JDBCDriverConnectionAsset.java:56) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime$InstanceEntry.open(LocalAssetRuntime.java:1909) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime$InstanceEntry.checkOut(LocalAssetRuntime.java:1292) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime$RuntimeEntry.checkOut(LocalAssetRuntime.java:705) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime.doOpenAsset(LocalAssetRuntime.java:165) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime.openAssetInScope(LocalAssetRuntime.java:122) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime.openAssetInScope(LocalAssetRuntime.java:120) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime.openAssetInScope(LocalAssetRuntime.java:120) [junitlisa]      at com.itko.lisa.asset.LocalAssetRuntime.openAsset(LocalAssetRuntime.java:113) [junitlisa]      at com.itko.lisa.jdbc.JDBCConnAssetNode.getConnection(JDBCConnAssetNode.java:214) [junitlisa]      at com.itko.lisa.jdbc.JDBCNode.executeSQL(JDBCNode.java:370) [junitlisa]      at com.itko.lisa.jdbc.JDBCConnAssetNode.executeSQL(JDBCConnAssetNode.java:179) [junitlisa]      at com.itko.lisa.jdbc.JDBCNode.execute(JDBCNode.java:341) [junitlisa]      at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981) [junitlisa]      at com.itko.lisa.test.TestCase.execute(TestCase.java:1288) [junitlisa]      at com.itko.lisa.test.TestCase.execute(TestCase.java:1203) [junitlisa]      at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188) [junitlisa]      at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1129) [junitlisa]      at com.itko.lisa.coordinator.Instance.run(Instance.java:204)


  • 13.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 03, 2017 04:19 PM

    Are you passing more than args? try with one. it might fix the password exception too.



  • 14.  Re: Pass Jenkins Parameters to DevTest
    Best Answer

    Posted Aug 10, 2017 02:00 AM

    JVM Arguments Options 

     

    This option may or may not work, depending on how and where the test is staged and executed.  If the test is staged on remote server or even the simulator is running remote server the JVM arguments will not be passed

      

       I really did not understand what is the real issues of keeping the values in excel, CSV# file and let the test to read the file to load the desired values  anyway below  are my recommendations

     

     

     My Recommendation 

     

     Jenkins Integration with DevTest the  best recommend approach is to Lisa Invoke REST API  or Swagger API to execute the test 

     

    Solution Approach 1: Using LISA INVOKE REST API :   (Best Options )

     

    Job 1 

     

    Get  the Results 

     

    Job2 

     

    Step1

    Jenkins to the copy the project to the remote servers under $LISA_HOME/Projects

     

     

    Step2

    Create a config file (say jenkins.config) with required properties and push it $LISA_HOME/Projects/YourProject/Configs folder 

     

     

    Step3 

    Using Lisa Invoke REST API  

    Run test cases: http://servername:1505/lisa-invoke/runTest?testCasePath=testCasePath&[stagingDocPath=stagingDocPath]&[configPath=Projects/YourProject/Config/Jenkins.config]&[async=true]&[coordName=csName]

     

     

     

    Solution Approach2: Using Swagger API  (In this options the test should read the properties from  the shared file / data base /  or by calling Virtual Services)

     

     

    Job 1 

     

    Get  the Results  and save them in one the options 

     

    1.  Shared properties file 

     

    2. Database

     

    3. Virtual Services 

     

    Job2 

     

    Step1

    Jenkins to the copy the project to the remote servers under $LISA_HOME/Projects

     

     

    Step2

    Create a config file (say jenkins.config) with required properties and push it $LISA_HOME/Projects/YourProject/Configs folder 

     

     

    Step3 

    Using Swagger API (http://localhost:1505/api/swagger)

    Run test cases: 

     

    Note  :  Please check  this communities page link , how to execute the rest api using Jenkins 

     

     

    https://communities.ca.com/docs/DOC-231172592-jenkins-pipeline-integration-with-devtest

     

     

     

    Thanks,

    Vamsi Kurukuri

     

     

    #Jenkins #Integration #TestCase #Deploy #Stage



  • 15.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 11, 2017 10:47 AM

    Thanks Vamsi, Yeah I know Lisa Invoke is the best option, but as we have Jenkins on one machine and DevTest Project on other ( registry running on docker) we had issues. So you recommend to have Jenkins and DevTest projects on same machine? 



  • 16.  Re: Pass Jenkins Parameters to DevTest

    Posted Aug 30, 2017 11:19 AM

    Vamsi,

    Can you reply to Jagadish's latest reply?



  • 17.  Re: Pass Jenkins Parameters to DevTest

    Posted Sep 20, 2017 03:47 PM

    we tried this locally where we have Jenkins and Devtest installed on the same linux server. Also added the something like this in simulatorservice.vmoptions file ( DPropertyName=propertyValue). but did not work



  • 18.  Re: Pass Jenkins Parameters to DevTest

    Posted Oct 30, 2017 11:14 AM

    Easiest way is to use a plugin. add the parameters in the config file.