[JIRA] (JENKINS-60940) Convert git client plugin tests from JUnit 3 to JUnit 4

27 views
Skip to first unread message

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 2, 2020, 3:32:03 AM2/2/20
to jenkinsc...@googlegroups.com
Mark Waite created an issue
 
Jenkins / Bug JENKINS-60940
Convert git client plugin tests from JUnit 3 to JUnit 4
Issue Type: Bug Bug
Assignee: Mark Waite
Components: git-client-plugin
Created: 2020-02-02 08:31
Labels: newbie-friendly
Priority: Minor Minor
Reporter: Mark Waite

The git client plugin tests have started their transition process to retire the JUnit 3 based GitAPITestCase, CliGitAPIImplTest, and JGitAPIImplTest. They should be replaced by the parameterized GitClientTest.

For each test in GitAPITestCase, CliGitAPIImplTest, and JGitAPIImplTest:

  • If it is already tested in GitClientTest, delete the test from the JUnit 3 based tests
  • If it is not already tested in GitClientTest, write a test in GitClientTest and delete the test from the JUnit 3 based tests

This issue could be worked by multiple people concurrently, so long as they coordinate with one another on the specific tests they are converting.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 5, 2020, 10:04:02 AM2/5/20
to jenkinsc...@googlegroups.com
Mark Waite assigned an issue to Unassigned
Change By: Mark Waite
Assignee: Mark Waite

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Feb 5, 2020, 3:49:02 PM2/5/20
to jenkinsc...@googlegroups.com
Rishabh Budhouliya commented on Bug JENKINS-60940
 
Re: Convert git client plugin tests from JUnit 3 to JUnit 4

Hi Mark Waite

While I was looking at some test cases written in Junit 3, I can see those tests using private methods provided by a private inner class. While porting those tests, would you consider making those classes public so that GitClientTest can access it or would you like a plain copy of that particular private class? 

If there is a better option would like to hear that!

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 5, 2020, 3:57:03 PM2/5/20
to jenkinsc...@googlegroups.com

You're welcome to convert private inner classes in tests into public classes.

loghijiaha.16@cse.mrt.ac.lk (JIRA)

unread,
Feb 5, 2020, 4:44:03 PM2/5/20
to jenkinsc...@googlegroups.com

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Feb 5, 2020, 4:52:02 PM2/5/20
to jenkinsc...@googlegroups.com

Hi Loghi Perinpanayagam,

I have ported the CliGitAPIImplTest Junit 3 tests to GitClientTest.

You can work on GitAPITestCase or JGitAPIImplTest. Please mention the class here so that anyone can work on the other one. Thanks!

loghijiaha.16@cse.mrt.ac.lk (JIRA)

unread,
Feb 6, 2020, 11:05:02 AM2/6/20
to jenkinsc...@googlegroups.com

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 6, 2020, 11:23:03 AM2/6/20
to jenkinsc...@googlegroups.com
Mark Waite started work on Bug JENKINS-60940
 
Change By: Mark Waite
Status: Open In Progress

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 6, 2020, 11:23:03 AM2/6/20
to jenkinsc...@googlegroups.com

loghijiaha.16@cse.mrt.ac.lk (JIRA)

unread,
Feb 6, 2020, 11:44:03 AM2/6/20
to jenkinsc...@googlegroups.com

Any efficient idea you could suggest to check whether the test already implemented or not in GitClientTest ?

rishabhbudhouliya+jenkins@gmail.com (JIRA)

unread,
Feb 6, 2020, 12:22:02 PM2/6/20
to jenkinsc...@googlegroups.com

I'm not sure how Mark would suggest it, but here is my opinion:

1) The first obvious way would be to search for the same test-case name, for example: testRefSpecWithNullValues might be referred with a similar name in GitClientTest.
2) If the name isn't obvious then try to understand what the test is asserting and try to find the same definition.

Also, if you are using IntelliJ it automatically highlights duplicate code, so that can be also used.

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 6, 2020, 12:33:03 PM2/6/20
to jenkinsc...@googlegroups.com

Loghi Perinpanayagam I like the suggestion from Rishabh Budhouliya to review the test names and the test assertions.

Some assertions are not immediately visible (like the assertion of expected job status in the build() calls, but assertions are a very useful way to avoid losing knowledge in the transition from JUnit 3 to JUnit 4.

loghijiaha.16@cse.mrt.ac.lk (JIRA)

unread,
Feb 6, 2020, 1:20:03 PM2/6/20
to jenkinsc...@googlegroups.com

Great thanks. Mark Waite and Rishabh Budhouliya I check it out. I think most of the test cases lie on GitAPITestCase. @NotImplementedInJGit annotations are helping to identify the relevant tests in my case.

mark.earl.waite@gmail.com (JIRA)

unread,
Feb 20, 2020, 1:02:03 PM2/20/20
to jenkinsc...@googlegroups.com
Mark Waite updated an issue
 
Change By: Mark Waite
The git client plugin tests have started their transition process to retire the JUnit 3 based GitAPITestCase, CliGitAPIImplTest, and JGitAPIImplTest.  They should be replaced by the parameterized GitClientTest.

For each test in GitAPITestCase, CliGitAPIImplTest, and JGitAPIImplTest:
* If it is already tested in GitClientTest, delete the test from the JUnit 3 based tests
* If it is not already tested in GitClientTest, write a test in GitClientTest
or in a new test class and delete the test from the JUnit 3 based tests


This issue could be worked by multiple people concurrently, so long as they coordinate with one another on the specific tests they are converting.
Reply all
Reply to author
Forward
0 new messages