Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrating from JUnit 4/3 to JUnit 5 for testing #85

Open
Tracked by #88
krisstern opened this issue Jan 31, 2022 · 20 comments
Open
Tracked by #88

Migrating from JUnit 4/3 to JUnit 5 for testing #85

krisstern opened this issue Jan 31, 2022 · 20 comments

Comments

@krisstern
Copy link
Member

What feature do you want to see added?

Currently the codebase uses JUnit 4 for testing. Would be ideal if the tests could be updated to use JUnit 5 for this plugin, in order to harness the latest features from Java 8 or later, such as the lambda functions, rendering the tests more powerful and easier to maintain.

More info about the major differences and benefits of migrating from JUnit 4 to JUnit 5 can be found for example in this blog post from Oracle.

Upstream changes

No response

@baruKreddy
Copy link
Contributor

@krisstern I would like to work on this. is there any jira task created for this issue?

@krisstern
Copy link
Member Author

Hi @baruKreddy! We are not currently using JIRA. You are welcome to start work on the issue.

@baruKreddy
Copy link
Contributor

Thanks:) @krisstern

@baruKreddy
Copy link
Contributor

baruKreddy commented Mar 7, 2022

@krisstern I can see https://github.com/jenkinsci/junit-plugin/blob/master/pom.xml the version is managed in parent still. So where should we go for a version change.

@krisstern
Copy link
Member Author

The issue now is split into two parts:

  1. Non-integration tests
  2. Integration tests

@Urjaswi-2655
Copy link

Urjaswi-2655 commented Mar 14, 2022

Hi, @krisstern ,I would like to work on Migrating from JUnit 4 to JUnit 5 for Integration testing issue .
I have no prior experience in testing, but I would like to learn.
Pls help me to get started.
Before asking for help,I read this doc to understand Integration Testing ( https://www.javatpoint.com/integration-testing )
And read the document for major differences and benefits of migrating from JUnit 4 to JUnit 5(Although , I have not understood everything).
And went through issue #88 , and read the comments and changes .(Not understood, completely)

Please help,if possibe,Thanks.

@krisstern
Copy link
Member Author

There is this book called "Junit in Action", 3rd edition that may be useful for this task. You can find free PDF copies on the internet or pay for a copy. They do have a chapter dealing migrating from Junit 4 to Junit 5 in particular. (I have access to it via my O'Reilly subscription.)

I think the book would be a good starter to begin on a PR to complete this issue.

@Urjaswi-2655
Copy link

Thanks, @krisstern I downloaded that book . (I will read it)

@krisstern
Copy link
Member Author

HI @Urjaswi-2655 If you are looking for relevant Udemy courses there is a free one https://www.udemy.com/course/junit-quick-start-for-beginners-java-unit-testing/. But this does not dive deep into migration from Junit 4 to Junit 5. So naturally you should fall back on the book preferably.

@Urjaswi-2655
Copy link

Thanks @krisstern I will cover it now

@i-laird
Copy link

i-laird commented May 8, 2022

@Urjaswi-2655 How is this going?

@shamlymhd
Copy link

Hi @krisstern I would like to work on this issue. can I start work on this?

@krisstern
Copy link
Member Author

Hi @shamlymhd Sure, I don't think anyone else is working on the issue at the moment

@priyadarshan85
Copy link

Is anyone working on this issue?

@krisstern
Copy link
Member Author

No, don't think so

@priyadarshan85
Copy link

I see that the migration to Junit 5 is already done. Whats pending on this issue?

@krisstern
Copy link
Member Author

It's not 100% completed yet, only partially done.

@priyadarshan85
Copy link

priyadarshan85 commented Oct 8, 2022

All test cases are not passing ? Is it? Because pom.xml shows the upgrade to latest junit 5 version. Running tests now

@priyadarshan85
Copy link

@krisstern Getting following error when I build the project:

image

Am I missing something here

@krisstern
Copy link
Member Author

All test cases are not passing ? Is it? Because pom.xml shows the upgrade to latest junit 5 version. Running tests now

I think it is the codebase that needs upgrading, as supposedly the "integration" tests have not been updated to JUnit 5 according to some comments of a previoius contributor. The tests are all passing. I can build it locally with no issues.

Screenshot 2022-10-08 at 2 59 02 PM

@krisstern krisstern changed the title Migrating from JUnit 4 to JUnit 5 for testing Migrating from JUnit 4/3 to JUnit 5 for testing Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants