Jmeter - Getting previous results in mail

2020-05-07 04:22发布

问题:

I'm using Jmeter - it runs automatically every 4 hours (through crontab). I'm sending the results file (csv) in the mail at the end of the test. I always see the file of the previous test, not the current one (I can see by the hour).

the structure is this: one 'Test Plan' (I checked 'Run Thread Groups consecutively' and 'Run tearDown Thread Groups after shutdown of main threads), two 'Thread Groups' - which at the end of each I write results to csv file using 'View Results Tree', and at the end - 'TearDown Thread Group' that uses SMTP sampler to send the files created.

any help would be appreciated.

EDIT: This is the SMTP sampler settings:

and this is the writing to the file:

回答1:

This might be due to Autoflush policy which flushes content of buffer only when buffer is reached. As you use a tear down thread group results are nit guaranteed to be fully written as test is not really finished. The fact that you think you are sending previous test file might be due to jmeter appending data to the same results file.

So :

1/ ensure you move or delete the file once sent

2/ Edit user.properties and add:

jmeter.save.saveservice.autoflush=true This will make jmeter write to file any sample result immediately afte it is executed.