---
title: "Discussion on \"How to pass parameterized test parameters to BeforeEach/AfterEach method in Junit5\" | Hashnode"
description: "Discussion on \"How to pass parameterized test parameters to BeforeEach/AfterEach method in Junit5\". Some time ago, when I was implementing some performance test I faced the issue with parameterized tests and BeforeEach/AfterEach methods. I tried to test some scenario against few implementations of Pulsar functions to compare their performance. My i..."
url: "https://hashnode.com/posts/how-to-pass-parameterized-test-parameters-to-beforeeachaftereach-method-in-junit5/6016fd99a4a28d1fcefcdbe9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to pass parameterized test parameters to BeforeEach/AfterEach method in Junit5](https://code-case.hashnode.dev/how-to-pass-parameterized-test-parameters-to-beforeeachaftereach-method-in-junit5?utm_source=hashnode&utm_medium=feed)

Some time ago, when I was implementing some performance test I faced the issue with parameterized tests and BeforeEach/AfterEach methods. I tried to test some scenario against few implementations of Pulsar functions to compare their performance. My i...

Jan 31, 2021 · 8 min read · code-case.hashnode.dev  
Updated Feb 12, 2021  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#junit](https://hashnode.com/tag/junit)

## Written by

[code-case](https://hashnode.com/@code-case)

@code-case · Wrocław, Poland

  
[View profile](https://hashnode.com/@code-case)

Software Developer

Recently I heard few times the joke that the programming in our times means just copying and pasting code from stackoverflow. Maybe it's true in many cases, but still there are some situations when we can't find solution even there. My idea is to share my solutions for such issues on that blog. Unfortunatelly, english isn't my native language so I bank on your indulgence. It's the next reason why I'm trying to write in english even if I'm not so familiar with it. It's the opportunity to improve my skills also in that area. I hope that you will find some interresting content on my blog. So, just enjoy and don't hesitate to give me some feedback.

## Responses 2

Markdown supported · ⌘↵ to post

[Igor Vlasyuk](https://hashnode.com/@igorek9191)

[Oct 26, 2021](https://hashnode.com/posts/how-to-pass-parameterized-test-parameters-to-beforeeachaftereach-method-in-junit5/6016fd99a4a28d1fcefcdbe9/comment/6177f281fc34737bf9ab76a7)

Thank you sir for your solution. But there is one point that could be improved: if a test class has 3 test cases, and every one should be ran with 3 parameters, it means that one test class contains 9 test cases. And if tests will fail then it would hard to understand what exactly tests were fallen.

![2021-10-26_15-19-41.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1635250813614/NoZDnygQJ.png)

[Long Nguyen](https://hashnode.com/@zcmgyu)

[Sep 21, 2021](https://hashnode.com/posts/how-to-pass-parameterized-test-parameters-to-beforeeachaftereach-method-in-junit5/6016fd99a4a28d1fcefcdbe9/comment/614996ce699fe76cd3485d28)

Many thanks. This one is helpful :D
