jmeter

How to push live Jmeter JTL data to Jenkins console


We are working on pushing live JTL data to the Jenkins console output during test execution. Could you please guide us on how to achieve this?

not able to find any info related to same


Solution

  • You can add a new Thread Group with JSR223 Sampler and the code like this:

    import java.nio.file.Files
    import java.nio.file.Paths
    
    def filePath = 'result.jtl'
    
    def path = Paths.get(filePath)
    
    Files.newBufferedReader(path).withReader { reader ->
        while (true) {
            def line = reader.readLine()
    
            if (line != null) {
                OUT.println line
            } else {
                Thread.sleep(100)
            }
        }
    }
    

    it will read result.jtl file from the current folder and print its contents into STDOUT


    In order to choose what columns are in the .jtl results file you can amend JMeter's Results File Configuration by manipulating appropriate JMeter Properties