Forum Discussion

mshah's avatar
mshah
New Contributor
6 years ago

Is there anyway I can enable all tests on Jenkins?

I have a test suite that have multiple projects.

 

While working on writing tests, we sometimes miss to enable all tests and start execution on Jenkins.

 

Now, when we look at the results, we will see execution of tests that are only enabled.

 

So, we enable all tests and push the code and execute tests on Jenkins again.

 

Is there anyway, so, if we miss to enable all tests, Jenkins should still execute all tests.

 

Can we configure TC Jenkins plugin? or can we use some perticular command line? Or do we have to set any property of the project?

4 Replies

  • cunderw's avatar
    cunderw
    Community Hero

    Test Completenor jenkins have a built in way to do this, but a very easy solution can be made with powershell which you should be able to execute via batch command from Jenkins.

     

    Test Complete project files are just xml files that can be manipulated pretty easily. We drive all of our test plans with data from Jira to determine if a test item should or should not be ran.

     

    Something like this should enable all test items in a project if that is what you are defining as a test. 

     

    function enabledAll(){
    	[xml]$xml = Get-Content <path to project>
    	Write-Host "Enabling all test items in project"
    	$testItems = Select-Xml -Xml $xml -XPath ".//testItem[@group='False']"
    	foreach($test in $testItems){
    		$test.Node.enabled = "True"
    	}
    }

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The problem is in the definition of a "test".  Is it a script function in a code unit? Is it a Keyword test? Is it a test item in the Project node?  What is a "test" in your particular structure?  Everyone who uses TestComplete does not use the same definition of what constitutes a test.  In our case, we use KeywordTests where each test case we want to execute is represented by a KeywordTest.  However, we have other KeywordTests that are mini-tests that we use as commonly executed tasks (logging into the application, executing "clean-up" code, etc).  So, to say "Run all tests" and have it run all the KeywordTests would not be what we desire.  Same for Script code.

     

    The vehicle, as I understand it, for Jenkins to execute tests has to do with the command line telling it to run a particular project and having that project have "Test Items" enabled/disabled to indicate what tests to run.  I could be wrong.. I don't use Jenkins... but that's really the key.  However you are determining what is a "test" is how you need to command Jenkins.  So, it sounds like you have some sort of "enable/disable" functionality which sounds like Test Items.  So, you can have Jenkins run each test item individually... but then you'd have to have a command line call for each one.  Ultimately, it sounds like you just execute the project and that will run all "enabled" test items.

     

    so... the short answer... no... You need to configure your test automation to have what you want to run configured before the Jenkins task executes.

    • mshah's avatar
      mshah
      New Contributor

      Yes, When I said, tests, I meant "Test Items" in TestComplete Project.

       

      Something like this.

       

      I have a ProjectSuite with name "PS1"

       

      Under the PS1, I have "Project1"

       

      When I go to properties page of "Project1", I see "Test Items" and click on it

       

      This is how my "Test Items" looks like

       

      Test Item 1 to open the application

      Test Item 2 to do some initial setup

      Test Item 3 is a group of items (Enabled)

      |- Child Test Item 1 (My Test that is enabled)

       

      |- Child Test Item 2 (My Test that is disabled)

       

      |- Child Test Item 1 (My Test that is disabled)

      Test Item 4 is a group of items (Disabled)

      |- Child Test Item 1 (My Test that is disabled)

       

      |- Child Test Item 2 (My Test that is enabled)

       

      |- Child Test Item 1 (My Test that is disabled)

      Test Item 5 to clean up

      Test Item 6 to close the app

       

       so, on Jenkins, I want all Test Items (tests) to execute, even though, few are disabled.

  • mshah's avatar
    mshah
    New Contributor

    cunderw

     

    thanks. How do I do it with TestComplete or Jenkins? Or windows batch command?