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

uiValidator.generateReport hangs on Windows 10 #92

Open
YevgenShem opened this issue Jul 2, 2018 · 2 comments
Open

uiValidator.generateReport hangs on Windows 10 #92

YevgenShem opened this issue Jul 2, 2018 · 2 comments
Assignees
Labels
Projects

Comments

@YevgenShem
Copy link

Both https://github.com/ITArray/automotion-appium-example and https://github.com/ITArray/automotion-selenium-example examples hang when executing uiValidator.generateReport method. After the hanging, the CPU load by Java process is increased to about 30% and then remains until the Java process killing. No reports are generated.

It does not matter whether the test launched via Maven or via IDE. It does not matter which Windows 10 edition(Home or Pro) is used.
Note that the same noticed examples work smoothly on Ubuntu 16.04 LTS, so it seems to be an OS-depended bug.

@dzaiats dzaiats added the bug label Jul 2, 2018
@dzaiats dzaiats self-assigned this Jul 2, 2018
@dzaiats dzaiats added this to In Progress in Automotion Jul 2, 2018
@dzaiats dzaiats moved this from In Progress to In Review in Automotion Jul 2, 2018
@dzaiats dzaiats assigned YevgenShem and unassigned dzaiats Jul 3, 2018
@YevgenShem
Copy link
Author

YevgenShem commented Jul 3, 2018

Tried the automotion-java 2.1.1 - unfortunately it did not help - the behaviour is the same :(
But when I tried step-by-step execution of the generateReport method call - I found an infinite loop in \net\itarray\automotion\internal\HtmlReportBuilder.java
while(true) {
if (!file.delete()) {
continue;
}
}
"!file.delete()" always returned False. And when I tried to delete the file manually via file manager - the Windows says that the file is used by another process so cannot be deleted.
Perhaps the file was not closed after creation? The mentioned file name is like TopSlider-automotion153063307014199b5470.json

@YevgenShem
Copy link
Author

Performing step-by-step debug, I found the following line in https://github.com/ITArray/automotion-java/blob/master/src/main/java/net/itarray/automotion/internal/HtmlReportBuilder.java :
Object obj = parser.parse(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));

In this line, the FileInputStream is opened, and remains opened when the following line executed:
while (!file.delete()) ;
Therefore Windows failed trying to delete the opened file. I don't really know how the deletion works in *nix, but anyway, Windows does not allow such deletion.
Then I made the following change:

//                                Object obj = parser.parse(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8));

                                Object obj;
                                try(InputStreamReader inputStreamReader = new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8)){
                                    obj = parser.parse(inputStreamReader);
                                }

Then I built automotion-2.1.0.jar locally and connected this .jar to automotion-selenium-example project.
Finally, when running automotion-selenium-example project - it does not hang and generates reports.
So it seems like a working fix.

I tried to create pull request, but didn't managed to push my branch to remote.
So Denys, if you OK with the change - could you please implement the update?

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

No branches or pull requests

2 participants