mirror of
https://github.com/pnx/neotest-phpunit
synced 2026-06-16 03:54:55 +02:00
Add test for single result
This commit is contained in:
parent
c017340679
commit
f2e87a2f99
1 changed files with 54 additions and 1 deletions
|
|
@ -1,8 +1,9 @@
|
||||||
local utils = require("neotest-pest.utils")
|
local utils = require("neotest-pest.utils")
|
||||||
|
|
||||||
describe("get_test_results", function()
|
describe("get_test_results", function()
|
||||||
|
local output_file = "/tmp/nvimhYaIPj/3"
|
||||||
|
|
||||||
it("parses output with whole file", function()
|
it("parses output with whole file", function()
|
||||||
local output_file = "/tmp/nvimhYaIPj/3"
|
|
||||||
local xml_output = {
|
local xml_output = {
|
||||||
testsuites = {
|
testsuites = {
|
||||||
testsuite = {
|
testsuite = {
|
||||||
|
|
@ -163,4 +164,56 @@ describe("get_test_results", function()
|
||||||
|
|
||||||
assert.are.same(utils.get_test_results(xml_output, output_file), expected)
|
assert.are.same(utils.get_test_results(xml_output, output_file), expected)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('parses output with single test', function()
|
||||||
|
local xml_output = {
|
||||||
|
testsuites = {
|
||||||
|
testsuite = {
|
||||||
|
_attr = {
|
||||||
|
assertions = "3",
|
||||||
|
errors = "0",
|
||||||
|
failures = "0",
|
||||||
|
name = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
|
||||||
|
skipped = "0",
|
||||||
|
tests = "1",
|
||||||
|
time = "0.004366",
|
||||||
|
warnings = "0"
|
||||||
|
},
|
||||||
|
testsuite = {
|
||||||
|
_attr = {
|
||||||
|
assertions = "3",
|
||||||
|
errors = "0",
|
||||||
|
failures = "0",
|
||||||
|
file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
|
||||||
|
name = "P\\Tests\\Feature\\UserTest",
|
||||||
|
skipped = "0",
|
||||||
|
tests = "1",
|
||||||
|
time = "0.004366",
|
||||||
|
warnings = "0"
|
||||||
|
},
|
||||||
|
testcase = {
|
||||||
|
_attr = {
|
||||||
|
assertions = "3",
|
||||||
|
class = "Tests\\Feature\\UserTest",
|
||||||
|
classname = "Tests.Feature.UserTest",
|
||||||
|
file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
|
||||||
|
name = "addFavoriteMovie",
|
||||||
|
time = "0.004366"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local expected = {
|
||||||
|
["/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php::addFavoriteMovie"] = {
|
||||||
|
output_file = output_file,
|
||||||
|
short = "TESTS.FEATURE.USERTEST\n-> PASSED - addFavoriteMovie",
|
||||||
|
status = "passed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.are.same(utils.get_test_results(xml_output, output_file), expected)
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue