GHPReporter/Ghpr.Core

Better exception handling

Closed this issue · 4 comments

Describe the bug
One day, I cannot say why, our runs.json happened to be empty.
Then running any suite generates exception file for each test to be stored. So, you can imagine that with bigger suite, it generates a lot of garbage.
I've now finished deleting 1 500 000 files.

To Reproduce
empty runs.json file
run tests in same suite

Expected behavior
append exceptions per run or limit number of exception files and rotate
handle empty runs.json file properly as not existing

Additional context
Exception file:
9. 1. 2019 4:13:49: Exception in method 'b__0'
Message:
Object reference not set to an instance of an object.
Source:
Ghpr.Core
StackTrace:
at Ghpr.Core.Helpers.ItemInfoHelper.SaveItemInfo(String path, String filename, ItemInfo itemInfo, Boolean removeExisting) in Ghpr.Core\Helpers\ItemInfoHelper.cs:line 34
at Ghpr.Core.Helpers.RunsHelper.SaveCurrentRunInfo(String path, ItemInfo runInfo) in Ghpr.Core\Helpers\RunsHelper.cs:line 10
at Ghpr.Core.Reporter.<>c__DisplayClass27_0.b__0() in Ghpr.Core\Reporter.cs:line 93
at Ghpr.Core.Helpers.ActionHelper.Simple(Action a) in Ghpr.Core\Helpers\ActionHelper.cs:line 26

Hi @ParanoikCZE !
Thank you for the issue, I'll try to include it in the next release.

Work to fix the issue should include:

  1. Create exception files in a separate folder (new folder for each run probably). It will give an ability to simply remove all exceptions.
  2. Create backup file for runs.json which should give an ability to manually restore the prevoius version of the file.

Thank you

Hi @ParanoikCZE !
Can you please check that you are using the latest Ghpr.Core version?

According to the stack trace the version is old, there are no such classes as ItemInfoHelper and RunsHelper in the current code.

Thank you

Also no exception files should be created

Nice catch, seems like our update process is not working as expected. :(
I've updated core to latest. Thanks and sorry.