bitwes / Gut

Godot Unit Test. Unit testing tool for Godot Game Engine.
1.81k stars 100 forks source link

Cannot find test path in export #255

Closed piiertho closed 2 years ago

piiertho commented 3 years ago

Hello there !

I'm trying to export a project with gut as main scene, in order to be able to test godot-jvm feature on all platforms. I followed this documentation, to export this project.

I set script as text:
image

When I try to run the export, I got this:
image

I checked with pck unpacker, and scripts are there in text format.

Do you have any clue about what I'm doing wrong ?

bitwes commented 3 years ago

I'm seeing the same thing in MacOS, but not Android (at least when running on device from Godot). I'm not sure what the problem is.

I was able to get my tests to run on MacOS using the 2nd approach in the documentation. Those instructions are a little verbose, here's a quick version:

piiertho commented 3 years ago

I tried the second approach.

I set export path:
image

I connected the signal:
image

It seems this does not solve initial problem: image

bitwes commented 3 years ago

Export path must be a filename. Should end in .cfg

The directions are a little vague for that.

On Sun, Dec 20, 2020, 9:49 AM Pierre-Thomas Meisels < notifications@github.com> wrote:

I tried the second approach.

I set export path: [image: image] https://user-images.githubusercontent.com/48322356/102716208-9da3e600-42da-11eb-9f12-dada7977859b.png

I connected the signal: [image: image] https://user-images.githubusercontent.com/48322356/102716220-b6ac9700-42da-11eb-8ec2-d41f72c5a28e.png

It seems this does not solve initial problem: [image: image] https://user-images.githubusercontent.com/48322356/102716247-f1163400-42da-11eb-890e-0ee5294923cc.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitwes/Gut/issues/255#issuecomment-748617465, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2LKHBCNB35MCUNS2E5QTSVYFIRANCNFSM4VCLDG7Q .

piiertho commented 3 years ago

Do we have Any documentation about it ? I don't even know what should be in this cfg file.

bitwes commented 3 years ago

Sorry, the path should include the filename where the tests will be exported.

On Mon, Dec 21, 2020, 2:22 AM Pierre-Thomas Meisels < notifications@github.com> wrote:

Do we have Any documentation about it ? I don't even know what should be in this cfg file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitwes/Gut/issues/255#issuecomment-748811607, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2LKCIBLBRYS4BP6RPI63SV3ZU3ANCNFSM4VCLDG7Q .

piiertho commented 3 years ago

Sorry for late reply. What should I set in the cfg file ?

bitwes commented 3 years ago

GUT will create the file. The setting is the full path to a file that GUT will create upon exporting tests. The file holds exported test info. The file it makes is a cfg file and I suggested it be named with .cfg since it is a common extension to be exported.

For example, if you set it to "res://exported_gut_tests.cfg" then when GUT exports the tests it will make a file at "res://exported_gut_tests.cfg"

On Thu, Dec 24, 2020, 10:41 AM Pierre-Thomas Meisels < notifications@github.com> wrote:

Sorry for late reply. What should I set in the cfg file ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitwes/Gut/issues/255#issuecomment-750913840, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2LKCT6NUYRKF7B3444XDSWNOL7ANCNFSM4VCLDG7Q .

piiertho commented 3 years ago

On my side it does not create it but it complains it cannot find it :/ Will post screenshot as soon as I Can Access my computer

piiertho commented 3 years ago

Sorry for late reply again. I figured out the missed step. I was exporting tests right after editing export path. I had to run them once from editor to generate the cfg, then I was able to run from export.

bitwes commented 3 years ago

Great! If you have any suggestions for documentation changes please let me know. It is a confusing process. Hopefully a fix for the export as text issue can be found, which makes this process only necessary when you want to run tests with binary scripts.

On Tue, Dec 29, 2020, 4:27 AM Pierre-Thomas Meisels < notifications@github.com> wrote:

Sorry for late reply again. I figured out the missed step. I was exporting tests right after editing export path. I had to run them once from editor to generate the cfg, then I was able to run from export.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitwes/Gut/issues/255#issuecomment-752010007, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2LKFAO6ZZDP7WRALLIS3SXGOIPANCNFSM4VCLDG7Q .

bitwes commented 3 years ago

This Godot bug is the likely cause: https://github.com/godotengine/godot/issues/37646

I added some debug messages and it looks like there might be a way to work around it by just trying to open the directory and looking at the result instead of checking to see if it exists:

var test_d = Directory.new()
var result = test_d.open(path)
_lgr.log(str("open ", path, " = ", result))
_lgr.log(str("current dir = ",  test_d.get_current_dir()))
_lgr.log(str("it exists? =  ", test_d.dir_exists(path)))

prints

open res://test/unit = 0
current dir = res://test/unit
res://test/unit exists? =  False
bitwes commented 2 years ago

This appears to be fixed in Godot 3.3. I was able to run tests when exported for mac with scripts exported as text. I was not able to run tests when the scripts were exported compiled.

bitwes commented 2 years ago

Verified fixed in 3.3.2 as well. Let's hope it doesn't re-appear.