Skip to content

Make tests consistent#175

Merged
LorenzoBettini merged 7 commits into
pitest:masterfrom
JKutscha:Tests_consistency_fix
Aug 13, 2021
Merged

Make tests consistent#175
LorenzoBettini merged 7 commits into
pitest:masterfrom
JKutscha:Tests_consistency_fix

Conversation

@JKutscha

@JKutscha JKutscha commented Aug 9, 2021

Copy link
Copy Markdown
Contributor
  • don't rerun pit, if we run in a timeout
  • make sure we are getting the menu from the workbench window

* don't rerun pit, if we run in a timeout
* make sure we are getting the menu from the workbench window
@JKutscha JKutscha mentioned this pull request Aug 9, 2021
@JKutscha

JKutscha commented Aug 9, 2021

Copy link
Copy Markdown
Contributor Author

@LorenzoBettini or @echebbi would you have a look at these changes and merge please?

@LorenzoBettini LorenzoBettini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have a few doubts about the code: I think a few parts should be simplified as shown in the comments. I'd also like to know more about the situations they try to fix

pitclipseSteps.mutationIsOpened(BAR_CLASS + ".java", 7);
final long timeOutBefore = SWTBotPreferences.TIMEOUT;
try {
SWTBotPreferences.TIMEOUT = 10000;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do you need to play with SWTBot timeout in the test code?
Please don't do that!
We already increase SWTBot timeout in the Maven build and in the Eclipse launch configuration by passing something like

-Dorg.eclipse.swtbot.search.timeout=90000

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because this timeout value is used for how long we are waiting for the pit run. Currently, the timeout is set to 5 Seconds and I turned it up to 10 seconds to give pit enough time to finish.

Should I use the search timeout instead, but this seems to be very long?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that we should use the same timeout consistently and make it configurable from the outside as we do right now... @echebbi what do you think?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that we should use the same timeout consistently and make it configurable from the outside as we do right now

@LorenzoBettini I'm not sure I understood you, what do you mean exactly by "make it configurable from the outside"? As you said above the timeout is already configurable through the org.eclipse.swtbot.search.timeout property.

I agree that we should keep the timeout as consistent as possible thoughout the tests and avoiding changing it programmatically. Ideally I'd actually like to have a dedicated property that defines the timeout before we stop to wait for PIT so that we can change it without impacting the timeout for UI elements; something like org.pitest.pitclipse.tests.pit.timeout, but we'll see that it in another PR.

@JKutscha it looks like you reverted this change in your latest commit and the build seems to succeed so I guess this conversation can be closed? If you do need to increase the timeout, we set it here for the Maven build:

<argLine>${additionalTestArgLine} ${os-jvm-flags} -Dorg.eclipse.swtbot.search.timeout=90000</argLine>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think that we should use the same timeout consistently and make it configurable from the outside as we do right now

@LorenzoBettini I'm not sure I understood you, what do you mean exactly by "make it configurable from the outside"? As you said above the timeout is already configurable through the org.eclipse.swtbot.search.timeout property.

Sorry for the misunderstanding: I meant "keep it" as it is right now :)

I agree that we should keep the timeout as consistent as possible thoughout the tests and avoiding changing it programmatically. Ideally I'd actually like to have a dedicated property that defines the timeout before we stop to wait for PIT so that we can change it without impacting the timeout for UI elements; something like org.pitest.pitclipse.tests.pit.timeout, but we'll see that it in another PR.

Yes, that should be trivial to implement. If you have time please open an issue or I'll do that ASAP

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If you have time please open an issue or I'll do that ASAP

Done, see #178

}
}

public SWTBotMenu findWorkbenchMenu(final SWTWorkbenchBot bot, final String menuString) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It might be the case to write a well-documenting Javadoc here, in particular, the problems it fixes

@LorenzoBettini LorenzoBettini merged commit 3a0fe92 into pitest:master Aug 13, 2021
@LorenzoBettini

Copy link
Copy Markdown
Collaborator

Thank you @JKutscha !

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