Browse Source

output to src

ell 1 year ago
parent
commit
db600b7fb6
6 changed files with 35 additions and 29 deletions
  1. 1 1
      .github/workflows/main.yml
  2. 3 1
      .gitignore
  3. 5 3
      testing/classes/TestSuite.lua
  4. 2 0
      testing/output/readme.md
  5. 6 5
      testing/readme.md
  6. 18 19
      testing/todo.md

+ 1 - 1
.github/workflows/main.yml

@@ -234,7 +234,7 @@ jobs:
         name: love-macos
         path: love-macos.zip
     - name: Run All Tests
-      run: love-macos/love.app testing --runAllTests
+      run: love-macos/love.app/Contents/MacOS/love testing --runAllTests
     - name: Test Report
       uses: dorny/test-reporter@v1
       with:

+ 3 - 1
.gitignore

@@ -68,4 +68,6 @@ stamp-h1
 /src/love
 /src/tags
 .vs/
-.vscode/
+.vscode/
+/testing/output/*.xml
+/testing/output/*.html

+ 5 - 3
testing/classes/TestSuite.lua

@@ -144,9 +144,11 @@ TestSuite = {
       '<li>' .. finaltime .. 's</li></ul><br/><br/>'
 
     -- @TODO use mountFullPath to write output to src?
-    love.filesystem.createDirectory('output')
-    love.filesystem.write('output/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>')
-    love.filesystem.write('output/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
+    love.filesystem.mountFullPath(love.filesystem.getSource() .. "/output", "tempoutput", "readwrite")
+    love.filesystem.remove('tempoutput/' .. self.output .. '.xml')
+    love.filesystem.remove('tempoutput/' .. self.output .. '.html')
+    love.filesystem.write('tempoutput/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>')
+    love.filesystem.write('tempoutput/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
 
     self.module:log('grey', '\nFINISHED - ' .. finaltime .. 's\n')
     local failedcol = '\27[31m'

+ 2 - 0
testing/output/readme.md

@@ -0,0 +1,2 @@
+# Testing Output
+Any tests run will output an XML and HTML file here, assuming the tests are run with readwrite permissions for this repo

+ 6 - 5
testing/readme.md

@@ -34,9 +34,9 @@ If you want to specify only 1 specific method only you can use:
 
 All results will be printed in the console per method as PASS, FAIL, or SKIP with total assertions met on a module level and overall level.  
 
-An `XML` file in the style of [JUnit XML](https://www.ibm.com/docs/en/developer-for-zos/14.1?topic=formats-junit-xml-format) will be generated in your save directory, along with a `HTML` file with a summary of all tests (including visuals for love.graphics tests). 
+An `XML` file in the style of [JUnit XML](https://www.ibm.com/docs/en/developer-for-zos/14.1?topic=formats-junit-xml-format) will be generated in the `/output` directory, along with a `HTML` file with a summary of all tests (including visuals for love.graphics tests) - you will need to make sure the command is run with read/write permissions for the source directory.
 > Note that this can only be viewed properly locally as the generated images are written to the save directory.   
-> An example of both types of output can be found in the `/output` folder
+> An example of both types of output can be found in the `/examples` folder
 
 ---
 
@@ -45,6 +45,7 @@ Each method has it's own test method written in `/tests` under the matching modu
 
 When you run the tests, a single TestSuite object is created which handles the progress + totals for all the tests.  
 Each module has a TestModule object created, and each test method has a TestMethod object created which keeps track of assertions for that method. You can currently do the following assertions:
+- **assertNotNil**(value)
 - **assertEquals**(expected, actual)
 - **assertNotEquals**(expected, actual)
 - **assertRange**(actual, min, max)
@@ -60,14 +61,14 @@ Example test method:
 love.test.filesystem.read = function(test)
   -- setup any data needed then run any asserts using the passed test object
   local content, size = love.filesystem.read('resources/test.txt')
-  test:assertNotEquals(nil, content, 'check not nil')
+  test:assertNotNil(content)
   test:assertEquals('helloworld', content, 'check content match')
   test:assertEquals(10, size, 'check size match')
   content, size = love.filesystem.read('resources/test.txt', 5)
-  test:assertNotEquals(nil, content, 'check not nil')
+  test:assertNotNil(content)
   test:assertEquals('hello', content, 'check content match')
   test:assertEquals(5, size, 'check size match')
-  -- no need to return anything just cleanup any objs if needed
+  -- no need to return anything or cleanup, GCC is called after each method
 end
 ```
 

+ 18 - 19
testing/todo.md

@@ -2,25 +2,24 @@
 
 # v0.2
 
-## Changed
-- Added tests for all obj creation, transformation, window + system info graphics methods
-- Added half the state methods for graphics + added placeholders for missing drawing methods
-- Added TestMethod:assertNotNil() for quick nil checking
-- Added time total to the end of each module summary in console log to match file output
-
-- Removed a bunch of unessecary nil checks
-- Removed :release() from test methods, collectgarbage("collect") is called between methods instead
-
-- Renamed /output to /examples to avoid confusion
-
-- Replaced love.filesystem.newFile with love.filesystem.openFile
-- Replaced love.math.noise with love.math.perlinNoise / love.math.simplexNoise
-
-- Fixed newGearJoint throwing an error in 12 as body needs to be dynamic not static now
+## Todo
+- finish graphics state methods
+- start graphics drawing methods
+- start object methods
+- look into XML reader github actions to display results in readme?
+  dorny/[email protected] seems to do it
+  would need to run the tests first then could use it like:
+
+  - name: Run Tests
+  - run: PATH_TO_BUILT_APP ./testing --runAllTests
+  - name: Test Report
+    uses: dorny/test-reporter@v1
+    with:
+      name: Test Output
+      path: output/*.xml
+      reporter: jest-junit
+      
+  and d. check format: https://github.com/testmoapp/junitxml
 
-- Some general cleanup, incl. better comments and time format in file output
 
-## Todo
-- graphics state methods
-- graphics drawing methods
 - need a platform: format table somewhere for compressed formats (i.e. DXT not supported)