Forum Discussion

ChandanD's avatar
ChandanD
Contributor
9 months ago

How to provide Entire suite as Project test in Jenkins for Test Execute

Hello,

I have configure my Jenkins build job as Build with Parameter where Parameter are String value of Project Names.

I want to execute entire project suite to pass as Build with Paramter. 

I have configured my build job to execute Project test. It takes ${Parameter_Name} and executes.

I want to pass Entire suite. How to do it.

 

17 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I suggest having two projects in Jenkins, one for Entire Suite and the other for individual project.

     

    Or, see if Jenkins Pipeline is able to help you as mentioned by sbellary 

    • sbellary's avatar
      sbellary
      Champion Level 0

      You need to create a Master Job with dropdown list for entire Suite and all the different projects you need. So that you can run whichever project you need. And this can be more easily created with Jenkins Pipeline.

      • ChandanD's avatar
        ChandanD
        Contributor

        I have option to configure the build job. Could you explain which option to be selected to make it working. 

        I liked your idea.

    • ChandanD's avatar
      ChandanD
      Contributor

      I want to execute entire project suite from Project parameter of Jenkins

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Select this option then,

     

    I don't quite understand the need for the parameter you want to use.

     

    • ChandanD's avatar
      ChandanD
      Contributor

      I know this option. With this it is working.

      But I want both Project test and Entire suite via Project test only.

  • sbellary's avatar
    sbellary
    Champion Level 0

    Looks like you are using "Freestyle Project" but I suggest using "Pipeline Project" gives more options and easier to work. But you can still do with your job too there is an option called "Entire Suite" select it and pass the value. 

     

    • ChandanD's avatar
      ChandanD
      Contributor

      Could you explain me in detailed way how do I achieve both from Entire Suite option. With screenshot

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You have the option to run the entire suite or an individual project within a suite.

     

    What's the difference between "I want to execute entire project suite from Project parameter of Jenkins" and selecting Entire Suite?

    • ChandanD's avatar
      ChandanD
      Contributor

      So no option to run entire project suite via Project?

      It is either entire Project suite or Individual Project only?

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Yes.

     

    I do not understand why you want to use a parameter to run the entire suite!? When you can select the option "Entire Suite" ğŸ˜•

    • ChandanD's avatar
      ChandanD
      Contributor

      The reason been - If developer makes changes in specific project then execution could be individual project and result would be in 10-15 min.

      If entire suite is executed then to get results it takes 1 hour as I have many projects. 

      I don't want to change the configuration every time.

      For final release execution of entire suite is best option.

      So, with Project I wish both.

       

      I hope you understood my pain.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you have 10 projects in a project suite, then create one build in Jenkins that will run your entire suite. Then create 10 builds for your individual projects. Once these have been set, you should not be making changes to the builds.

    • ChandanD's avatar
      ChandanD
      Contributor

      This is too much maintenance. I want to achieve it with one build job. It should be possible. 

      I feel sbellary idea and solution would be best. Just need more details how to configure the build job.

      • sbellary's avatar
        sbellary
        Champion Level 0

        ChandanD This is the Jenkins Pipeline Job I created based on your scenario just an example. Hope this helps...!

        pipeline {
          agent any
          parameters {
            Choice(
              name: 'Projects',
              choices: ['Entier Suite','Project1', 'Project2', 'Project3'],
              description: 'Select the required Project.'  
            )
          }
          stages {
            stage('Entier Suite') {
                when {equals expected: "Entier Suite", actual: "${params.Projects}"}
                steps {
                    script {                  
                        try{
                            downstreamJob = build job: "EntierSuiteJob", propagate: true, wait: true,
                            parameters: [
                                string(name: 'Parameter1', value: "${Parameter1}"),
                                string(name: 'Parameter2', value: "${Parameter2}")
                            ]                    
                        } catch (Exception e) {
                            echo 'Exception occurred: ' + e.toString()
                            error("Exception occurred at ${stage_name} --> " + e.toString())    
                        }
                    }              
                }
            }
            stage('Project1') {
                when {equals expected: "Project1", actual: "${params.Projects}"}
                steps {
                    script {                  
                        try{
                            downstreamJob = build job: "Project1Job", propagate: true, wait: true,
                            parameters: [
                                string(name: 'Parameter1', value: "${Parameter1}"),
                                string(name: 'Parameter2', value: "${Parameter2}")
                            ]                    
                        } catch (Exception e) {
                            echo 'Exception occurred: ' + e.toString()
                            error("Exception occurred at ${stage_name} --> " + e.toString())    
                        }
                    }              
                }
            }    
          }
        }