jenkinsci / build-timeout-plugin

Jenkins build-timeout plugin
https://plugins.jenkins.io/build-timeout/
31 stars 80 forks source link

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

Open krisstern opened 2 years ago

krisstern commented 2 years ago

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 commented 2 years ago

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

krisstern commented 2 years ago

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

baruKreddy commented 2 years ago

Thanks:) @krisstern

baruKreddy commented 2 years ago

@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 commented 2 years ago

The issue now is split into two parts:

  1. Non-integration tests
  2. Integration tests
Urjaswi-2655 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

krisstern commented 2 years ago

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 commented 2 years ago

Thanks @krisstern I will cover it now

i-laird commented 2 years ago

@Urjaswi-2655 How is this going?

shamlymhd commented 2 years ago

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

krisstern commented 2 years ago

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

priyadarshan85 commented 1 year ago

Is anyone working on this issue?

krisstern commented 1 year ago

No, don't think so

priyadarshan85 commented 1 year ago

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

krisstern commented 1 year ago

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

priyadarshan85 commented 1 year ago

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

priyadarshan85 commented 1 year ago

@krisstern Getting following error when I build the project:

image

Am I missing something here

krisstern commented 1 year ago

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