tilln / jmeter-iso8583

ISO8583 Plugin for JMeter
MIT License
62 stars 32 forks source link

Debug source code with Jmeter run #8

Closed Nzsquall closed 4 years ago

Nzsquall commented 4 years ago

Hi Till,

This is really good, thanks for the good work.

Sorry if the question is obvious, don't have much experience in Jmeter plug in development. Is there a way we can debug the Jmeter run with the source code in an IDE, to see how the detail implementation is done, for example, MACing, and PIN block calculation?

Just want to debug and see how a message is constructed and flying through.

Thanks Eric

Nzsquall commented 4 years ago

Just saw your instruction as:

Packager logging is not currently implemented, so debugging Packager issues should be done outside of JMeter.

Does it mean we wont be able to debug the packager with Jmeter run?

tilln commented 4 years ago

Hi @Nzsquall

Not sure I understand exactly what you want to do, and whether you're trying to diagnose an actual issue or you just wanting to explore how it works. Let me try anyway, and perhaps you can clarify what you're after.

debug the Jmeter run with the source code in an IDE, to see how the detail implementation is done

Debugging the JMeter run is possible but more complicated. You could start though with debugging test cases that set up everything around them so you don't need a full JMeter runtime environment. For example, look at ISO8583CryptoTest that calls the crypto operations you mention, e.g. shouldEncryptPINBlock or shouldAllowArbitraryMACField.

Does it mean we wont be able to debug the packager with Jmeter run?

Well, currently only the packed request is logged or written to JTL, so you have at least some level of debugging to confirm the packager result is what you expect. This won't give you much detail though if the packager is not doing what you expect.

What might possibly help is adding a JSR223 PreProcessor to your ISO8583 Sampler that sets the packager logger to the default one "Q2" that is directed to the JMeter log.

sampler.builder.msg.packager.setLogger(org.jpos.util.Logger.getLogger('Q2'), 'packager')

You may also want to look at message traces of your system under test, e.g. the HSM if you have MACing problems.

HTH

Nzsquall commented 4 years ago

Hi @tilln ,

Thanks for the information.

I was actually looking for something similar like this: https://stackoverflow.com/questions/21176130/debugging-jmeter-java-request-class-single-stepping-in-eclipse

Your information is quite helpful as well. I will give it a go.

Thanks again Eric

tilln commented 4 years ago

Hi @Nzsquall

Can this issue be closed or do you have something more tangible to fix/implement in the context of this plugin?

Nzsquall commented 4 years ago

Hi @tilln ,

Can close it now.

Thanks Eric

Nzsquall commented 4 years ago

In case this will help any one, if you need to step into the sampler source code for a Jmeter run, you can on Windows, open cmd and run this: set JVM_ARGS=-agentlib:jdwp=transport=dt_socket,server=y,address=8090

Where 8000 is the port for JVM remote debugging.

Or you can put this line in jmeter.bat (windows).

Then launch jmeter.bat, you will see the following output: Listening for transport dt_socket at address: 8090

Your Jmeter might not start at this stage.

Then in your favorite IDE (I used Intellij), create a remote run configuration, similar as below Java_remote_run_config

Then launch remote debug, then wait for Jmeter to start, and put a debug point in sampler source code, then run a test plan, you should be able to step through the source code like below: Debug run