godot-tester icon indicating copy to clipboard operation
godot-tester copied to clipboard

result-output-file not working sometimes

Open DavidOcacho opened this issue 1 year ago • 9 comments

Hey again!

This is my configuration:

  pass_tests:
    name: Passing GUT Tests
    runs-on: ubuntu-latest
    permissions: write-all
    steps:
      - uses: actions/[email protected]
      - run: touch ./godot/test_results.xml
      - run: ls && ls ./godot
      - uses: croconut/godot-tester@v5
        with:
          version: "4.1"
          path: "godot"
          import-time: "5"
          test-timeout: "45"
          minimum-pass: "1.0"
          test-dir: "res://test"
          config-file: "res://.gut_editor_config.json" 
          result-output-file: "test_results.xml"

After the tests are passed, I got this error:

/usr/lib/AnalyzeTestResults/AnalyzeTestResults.js:26
        throw new Error('No test results found');
              ^

Error: No test results found
    at analyzeTestResults (/usr/lib/AnalyzeTestResults/AnalyzeTestResults.js:26:15)
    at runTests (/index.js:15:21)

Which doesn't make a lot of sense cause I'm creating the file with the command touch ./godot/test_results.xml I also run the ls command to make sure the file was there. I also tried creating the file on the root folder instead of ./godot but same result.

Run ls && ls ./godot
  ls && ls ./godot
  shell: /usr/bin/bash -e {0}
Home
godot
scripts
addons
export_presets.cfg
icon.svg
icon.svg.import
project.godot
test
test_results.xml

Thanks in advance!

DavidOcacho avatar Jul 29 '23 12:07 DavidOcacho

Can I see your config files? Where does GUT output results when you run it locally?

croconut avatar Jul 29 '23 16:07 croconut

I didn't have a XML outpath set it up on my config files cause I thought it wasn't necessary.

This is my config file now and it isn't working yet:

{
 "background_color": "262626ff",
 "compact_mode": false,
 "config_file": "res://.gutconfig.json",
 "dirs": [
  "res://addons/og_local_multiplayer_input/test"
 ],
 "disable_colors": false,
 "double_strategy": 1,
 "errors_do_not_cause_failure": false,
 "font_color": "ccccccff",
 "font_name": "CourierPrime",
 "font_size": 16,
 "gut_on_top": true,
 "hide_orphans": false,
 "ignore_pause": false,
 "include_subdirs": false,
 "inner_class": null,
 "junit_xml_file": "./godot/test_results.xml",
 "junit_xml_timestamp": true,
 "log_level": 1,
 "opacity": 100,
 "paint_after": 0.1,
 "panel_options": {
  "font_name": "CourierPrime",
  "font_size": 30,
  "hide_output_text": false,
  "hide_result_tree": false,
  "hide_settings": false,
  "output_font_name": "CourierPrime",
  "output_font_size": 30,
  "use_colors": false
 },
 "post_run_script": "",
 "pre_run_script": "",
 "prefix": "test_",
 "selected": null,
 "should_exit": false,
 "should_exit_on_success": false,
 "should_maximize": false,
 "show_help": false,
 "suffix": ".gd",
 "tests": [],
 "unit_test_name": null
}

Thanks for the help

DavidOcacho avatar Jul 29 '23 18:07 DavidOcacho

Any ideas on this issue? Still can't figure it out, thanks!

DavidOcacho avatar Aug 01 '23 11:08 DavidOcacho

What's your current config? Do you get a results file generated when running locally? That path doesn't look right since it would generally be relative to your project folder, which is already in 'godot'. I would also recommend using 4.1 or whatever the previous version was so you can see gut's stdout and then swapping back to 5 when you don't need it.

I'll add in an issue to enable a verbose flag in a future release

croconut avatar Aug 01 '23 15:08 croconut

If I run it locally it works like a charm. I'm using Godot 4.1.

This is my current configuration, The ... on the path are the absolute path that I don't want to post it here.

{
    "background_color": "262626ff",
    "compact_mode": false,
    "config_file": "res://.gutconfig.json",
    "dirs": [
    "res://test"
    ],
    "disable_colors": false,
    "double_strategy": 1,
    "errors_do_not_cause_failure": false,
    "font_color": "ccccccff",
    "font_name": "CourierPrime",
    "font_size": 16,
    "gut_on_top": true,
    "hide_orphans": false,
    "ignore_pause": false,
    "include_subdirs": true,
    "inner_class": null,
    "junit_xml_file": ".../Home-Godot/godot/gut_results.xml",
    "junit_xml_timestamp": true,
    "log_level": 1,
    "opacity": 100,
    "paint_after": 0.1,
    "panel_options": {
    "font_name": "CourierPrime",
    "font_size": 30,
    "hide_output_text": false,
    "hide_result_tree": false,
    "hide_settings": false,
    "output_font_name": "CourierPrime",
    "output_font_size": 30,
    "use_colors": false
    },
    "post_run_script": "",
    "pre_run_script": "",
    "prefix": "test_",
    "selected": null,
    "should_exit": false,
    "should_exit_on_success": false,
    "should_maximize": false,
    "show_help": false,
    "suffix": ".gd",
    "tests": [],
    "unit_test_name": null
}

Nevertheless, the output is not saved on gut_results.xml is saved in gut_results and a buch of numbers.xml somethingn like gut_results_1231231231.122.xml

And this the godot/ folder image

DavidOcacho avatar Aug 01 '23 17:08 DavidOcacho

@DavidOcacho you're always welcome to refer to our test example files. I'll link one of our test projects so you can see. This one is a GUT 9 project. Looks to me like if you don't set the junit xml file path it will automatically pick the path we also expect by default.

https://github.com/croconut/godot-tester/tree/master/tester_GUT_v9.0.1

croconut avatar Aug 02 '23 00:08 croconut

Did you find a solution to your problem? I've got the same issue and can't find out any way to fix it. I tried playing with the config, disabling result-output-file altogether, creating xml files everywhere logical (root, .godot (through touch command), test folder, with my test file in test/unit) and setting "junit_xml_file":"user://resutls.xml" and "junit_xml_timestamp":false variables and I can't find out what is wrong, but it fails with the same error "throw new Error('No test results found');"

Edit: I finally succeded to make it work... by disabling import-time and test-timeout

Tarassin avatar Aug 03 '23 02:08 Tarassin

Yep, same for me.

In case this helps:

This is my action

  pass_tests:
    name: Checking PR GUT tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
      - uses: croconut/godot-tester@master
        with:
          version: "4.1"
          path: "godot"
          minimum-pass: "1.0"
          test-dir: "res://test"
          result-output-file: "test_results.xml"

I'm not using any config variable cause that was causing issues

DavidOcacho avatar Aug 03 '23 09:08 DavidOcacho

I think the issue is specifically caused by the setting import-time - without it, there does not seem to be an issue.

@DavidOcacho trying updating your action to touch the file first, e.g.

      - uses: actions/[email protected]
      - run: touch ./test_results.xml
      - uses: croconut/godot-tester@master

phil-hudson avatar Aug 14 '23 04:08 phil-hudson