Search code examples
drupaljmeterdrupal-8boundary

How to create article in Drupal 8 via JMeter?


I am trying to create a JMeter test case for article creation in Drupal 8. I am able to add steps for other navigations. But when clicking the Create Article button after entering some values in the form fields, from JMeter I am getting HTTP response 200. But the article is not getting created.

If I do the same steps in browser I am getting HTTP response 303 and article getting created successfully.

I found this in request headers of POST request while hitting the Create Article button. I am suspecting this might be the reason Drupal server is not accepting the request. Because I am not sure how this dynamic ID "JJPKbuyIinQT5mQZ" is getting generated

Is this being generated by browser? If yes, how to do the same action in JMeter?

Is this being generated by server? If yes, I don't see this token in previous request, like form_token.

enter image description here


Solution

  • This dynamic ID should be automatically generated by JMeter given you tick Use multipart/form-data for POST box, this is so called multipart boundary

    JMeter Drupal POST Request

    Other things to be considered:

    • Don't forget to add HTTP Cookie Manager, otherwise you will not be able to even perform a login

    • Correlate form_build_id and form_token. You can do this using CSS/JQuery Extractor

    • Correlate changed, you can generate timestamp like 1532969982 using __groovy() function like: ${__groovy(Math.round(System.currentTimeMillis() / 1000),)}
    • Correlate created[0][value][date]. You can do this using __time() function like ${__time(YYYY-MM-dd,)}
    • Correlate created[0][value][time]. You can do this using the same __time() function like ${__time(HH:mm:ss,)}

    That's probably it, other values should be good to be used from the recorder.

    JMeter Drupal Login