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

review: test: improve tests for abstractTemplate #3990

Merged
merged 4 commits into from
Jun 15, 2021
Merged

review: test: improve tests for abstractTemplate #3990

merged 4 commits into from
Jun 15, 2021

Conversation

Rohitesh-Kumar-Jain
Copy link
Contributor

#1818

Hi, I have improved both the test strength and mutation coverage from 75% to 100% class.

Here's the report before improvement.

Screen Shot 2021-06-14 at 14 57 08-fullpage

This PR was actually supposed to be raised in week 1, but I had to wait for tests to get converted in Junit5.

What I believe is, unhappy path test was missing for isWellFormed function which led to poor test strength in Descartes report, so I wrote a test for an unhappy path to fix that.

Next, for this week I will be working on the Substitution.java which is 660 lines of codes with many methods, so I believe I will raise another PR for that after a couple of days.

Link to #3967

@slarse slarse self-requested a review June 14, 2021 13:41
Copy link
Collaborator

@slarse slarse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good! I've confirmed that the new test does kill at least one mutant, so that's excellent.

Aside from the comments on the code, I also have one general comment: you don't necessarily need to mark the arrange/act/assert phases explicitly. In smaller tests, the comments can even be more distracting than. If you like to put them in that's all fine by me, but if the structure is evident I personally think they can be omitted.

src/test/java/spoon/test/template/TemplateTest.java Outdated Show resolved Hide resolved
// contract: IsWellFormed method of AbstractTemplate class returns false if there are zero template parameter

// arrange
AbstractTemplate abstractTemplate = new AbstractTemplate() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When naming variables, try to describe their intent instead of their static type. For example, this is more informative:

Suggested change
AbstractTemplate abstractTemplate = new AbstractTemplate() {
AbstractTemplate zeroParameterTemplate = new AbstractTemplate() {

src/test/java/spoon/test/template/TemplateTest.java Outdated Show resolved Hide resolved
Rohitesh-Kumar-Jain and others added 3 commits June 15, 2021 13:35
@Rohitesh-Kumar-Jain
Copy link
Contributor Author

Avoid using raw types.

Thanks for pointing this, I will keep this in mind for future PRs as well.

I think I have made the required changes

Copy link
Collaborator

@slarse slarse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rohitesh-Kumar-Jain Excellent work, will merge!

@monperrus Quick question: the rule about leaving pull requests open for at least one day, is that after being approved for merge, or from the time of the PR being opened? I interpret the guidelines as the latter, but just want to make sure :)

@monperrus
Copy link
Collaborator

Quick question: the rule about leaving pull requests open for at least one day, is that after being approved for merge, or from the time of the PR being opened?

From the time of the PR being opened.

@slarse
Copy link
Collaborator

slarse commented Jun 15, 2021

@monperrus Okay, thanks.

Now however, all checks are green yet I can't merge the PR (says I'm not authorized). Could you have a look at the permissions?

@monperrus
Copy link
Collaborator

The reason is that we're using "Restrict who can push to matching branches" to "Organization administrators, repository administrators, and users with the Maintain role. "

This means that write access was not enough. Given you the "maintainer" role.

Could you try again?

@slarse slarse merged commit 1c7d8f8 into INRIA:master Jun 15, 2021
@slarse
Copy link
Collaborator

slarse commented Jun 15, 2021

All good, first merge done :)

@Rohitesh-Kumar-Jain Rohitesh-Kumar-Jain deleted the improve-abstracttemplate branch June 15, 2021 14:42
@monperrus
Copy link
Collaborator

monperrus commented Jun 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants