Browse Source

fix xml format

ell 1 year ago
parent
commit
fae3b6ff63
4 changed files with 18 additions and 19 deletions
  1. 8 0
      .github/workflows/main.yml
  2. 4 3
      testing/classes/TestMethod.lua
  3. 0 2
      testing/classes/TestSuite.lua
  4. 6 14
      testing/todo.md

+ 8 - 0
.github/workflows/main.yml

@@ -205,6 +205,14 @@ jobs:
       with:
       with:
         name: love-windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}-dbg
         name: love-windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}-dbg
         path: pdb/Release/*.pdb
         path: pdb/Release/*.pdb
+    - name: Run All Tests
+      run: build/love-windows-${{ steps.vars.outputs.arch }}${{ steps.vars.outputs.compatname }}.exe testing --runAllTests
+    - name: Test Report
+      uses: dorny/test-reporter@v1
+      with:
+        name: Test Output
+        path: testing/output/*.xml
+        reporter: jest-junit
   macOS:
   macOS:
     runs-on: macos-latest
     runs-on: macos-latest
     steps:
     steps:

+ 4 - 3
testing/classes/TestMethod.lua

@@ -309,14 +309,15 @@ TestMethod = {
         output = self.result.key .. ' ' ..  self.result.message
         output = self.result.key .. ' ' ..  self.result.message
     end
     end
     if output == '' and self.skipped == true then
     if output == '' and self.skipped == true then
+      failure = '\t\t\t<skipped message="' .. self.skipreason .. '></skipped>'
       output = self.skipreason
       output = self.skipreason
     end
     end
 
 
     -- append XML for the test class result
     -- append XML for the test class result
-    self.testmodule.xml = self.testmodule.xml .. '\t\t<testclass classname="' ..
-      self.method .. '" name="' .. self.method ..
+    self.testmodule.xml = self.testmodule.xml .. '\t\t<testcase classname="' ..
+      self.method .. '" name="' .. self.method .. '" assertions="' .. tostring(#self.asserts) ..
       '" time="' .. endtime .. '">\n' ..
       '" time="' .. endtime .. '">\n' ..
-      failure .. '\t\t</testclass>\n'
+      failure .. '\t\t</testcase>\n'
 
 
     -- unused currently, adds a preview image for certain graphics methods to the output
     -- unused currently, adds a preview image for certain graphics methods to the output
     local preview = ''
     local preview = ''

+ 0 - 2
testing/classes/TestSuite.lua

@@ -145,8 +145,6 @@ TestSuite = {
 
 
     -- @TODO use mountFullPath to write output to src?
     -- @TODO use mountFullPath to write output to src?
     love.filesystem.mountFullPath(love.filesystem.getSource() .. "/output", "tempoutput", "readwrite")
     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 .. '.xml', xml .. self.xml .. '</testsuites>')
     love.filesystem.write('tempoutput/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
     love.filesystem.write('tempoutput/' .. self.output .. '.html', html .. self.html .. '</div></body></html>')
 
 

+ 6 - 14
testing/todo.md

@@ -6,20 +6,12 @@
 - finish graphics state methods
 - finish graphics state methods
 - start graphics drawing methods
 - start graphics drawing methods
 - start object 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 joystick/input stuff could be at least nil checked maybe?
+- add test run for linux, windows, + ios builds
+- pass in err string returns to the test output
+  maybe even assertNotNil could use the second value automatically
+  test:assertNotNil(love.filesystem.openFile('file2', 'r')) wouldn't have to change
 
 
 
 
 - need a platform: format table somewhere for compressed formats (i.e. DXT not supported)
 - need a platform: format table somewhere for compressed formats (i.e. DXT not supported)
+  could add platform as global to command and then use in tests?