output to src

This commit is contained in:
ell
2023-10-06 00:08:39 +01:00
parent 1692f7f2e8
commit db600b7fb6
6 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ jobs:
name: love-macos name: love-macos
path: love-macos.zip path: love-macos.zip
- name: Run All Tests - name: Run All Tests
run: love-macos/love.app testing --runAllTests run: love-macos/love.app/Contents/MacOS/love testing --runAllTests
- name: Test Report - name: Test Report
uses: dorny/test-reporter@v1 uses: dorny/test-reporter@v1
with: with:
+3 -1
View File
@@ -68,4 +68,6 @@ stamp-h1
/src/love /src/love
/src/tags /src/tags
.vs/ .vs/
.vscode/ .vscode/
/testing/output/*.xml
/testing/output/*.html
+5 -3
View File
@@ -144,9 +144,11 @@ TestSuite = {
'<li>' .. finaltime .. 's</li></ul><br/><br/>' '<li>' .. finaltime .. 's</li></ul><br/><br/>'
-- @TODO use mountFullPath to write output to src? -- @TODO use mountFullPath to write output to src?
love.filesystem.createDirectory('output') love.filesystem.mountFullPath(love.filesystem.getSource() .. "/output", "tempoutput", "readwrite")
love.filesystem.write('output/' .. self.output .. '.xml', xml .. self.xml .. '</testsuites>') love.filesystem.remove('tempoutput/' .. self.output .. '.xml')
love.filesystem.write('output/' .. self.output .. '.html', html .. self.html .. '</div></body></html>') 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') self.module:log('grey', '\nFINISHED - ' .. finaltime .. 's\n')
local failedcol = '\27[31m' local failedcol = '\27[31m'
+2
View File
@@ -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
View File
@@ -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. 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. > 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. 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: 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) - **assertEquals**(expected, actual)
- **assertNotEquals**(expected, actual) - **assertNotEquals**(expected, actual)
- **assertRange**(actual, min, max) - **assertRange**(actual, min, max)
@@ -60,14 +61,14 @@ Example test method:
love.test.filesystem.read = function(test) love.test.filesystem.read = function(test)
-- setup any data needed then run any asserts using the passed test object -- setup any data needed then run any asserts using the passed test object
local content, size = love.filesystem.read('resources/test.txt') 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('helloworld', content, 'check content match')
test:assertEquals(10, size, 'check size match') test:assertEquals(10, size, 'check size match')
content, size = love.filesystem.read('resources/test.txt', 5) 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('hello', content, 'check content match')
test:assertEquals(5, size, 'check size 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 end
``` ```
+19 -20
View File
@@ -2,25 +2,24 @@
# v0.2 # 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
- Some general cleanup, incl. better comments and time format in file output
## Todo ## Todo
- graphics state methods - finish graphics state methods
- graphics drawing methods - start graphics drawing methods
- start object methods
- look into XML reader github actions to display results in readme?
dorny/test-reporter@v1.6.0 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
- 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)