Search code examples
jmeteruuid

Is it possible to generate UUID v1 with JMeter?


I read JMeter's manual and saw that there is __uuid() function for JMeter. It allows to generate UUID type 4 for JMeter tests. Is it possible to generate UUIDv1 in JMeter or maybe some plugin exists.


Solution

  • I would recommend taking the following steps:

    1. Download Jug library (for example from here) and drop the .jar somewhere to JMeter Classpath
    2. Restart JMeter to pick the .jar up
    3. Once done you should be able to generate UUIDv1 using JSR223 Test Elements and Groovy language like:

      import com.fasterxml.uuid.EthernetAddress
      import com.fasterxml.uuid.Generators
      import com.fasterxml.uuid.impl.TimeBasedGenerator
      
      def addr = EthernetAddress.fromInterface()
      def gen = Generators.timeBasedGenerator(addr)
      def v1uuid = gen.generate()
      
      log.info(v1uuid.toString())
      

    Demo:

    JMeter Generate UUIDv1

    References: