Skip to content

Updates for base test and debugging capture #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 31, 2020

Conversation

bdw429s
Copy link
Contributor

@bdw429s bdw429s commented Jan 31, 2020

This change captures debug stream data from TestBox and logs it with the corresponding data. Also all test cases that extend CodewarsBaseSpec will automatically any output from the solution created via

writeOutput( 'test' )
echo( 'test' & chr(10) )
dump( var=['complex','data'], format='plain' )

and convert it to text for the log.

I recommend we edit existing CFML katas to extend this base test case instead of testbox.system.baseSpec and also modify the template test case to show this by default as well.

@bdw429s
Copy link
Contributor Author

bdw429s commented Jan 31, 2020

Furthermore, it is not necessary to install testbox separately now as it is included as a dependency of this package.

install Codewars/testbox-codewars

should grab everything

@kazk
Copy link
Member

kazk commented Jan 31, 2020

@bdw429s Thanks!

I'm testing it and it seems to work when the test case passes, but no logs are shown when it fails :/

Also, dump doesn't seem to support plain.

format [plain] is not supported, supported formats are [simple,text,html,classic,javascript,js]

@bdw429s
Copy link
Contributor Author

bdw429s commented Jan 31, 2020

Also, dump doesn't seem to support plain.

Oops, was typing from memory. I meant text but grrr, looks like some genius added HTML to the output of the text format. Ticket time.... Just ignore the dump bit, I was just trying to think of all the ways CFML allows you to write to the output buffer.

@bdw429s
Copy link
Contributor Author

bdw429s commented Jan 31, 2020

but no logs are shown when it fails

Good catch. It seems that the savecontent construct doesn't capture the nested output if there's an exception raised (failures raise an exception that the test framework catches). I'm not sure if that's right or not 🤔

No matter, I've worked around it in my latest commit so output makes it ot the debug stream even in the event of a failure.

@bdw429s
Copy link
Contributor Author

bdw429s commented Jan 31, 2020

And in case anyone is keeping track...

Re: cfdump format=text stupidly showing HTML
https://luceeserver.atlassian.net/browse/LDEV-2669

Re; cfsavecontent losing content buffer prior to exception
https://luceeserver.atlassian.net/browse/LDEV-2670

Those tickets don't affect this pull at all, I just linked to them since they came up in the conversation here.

@kazk
Copy link
Member

kazk commented Jan 31, 2020

Thanks @bdw429s, I confirmed it working with failed cases as well. I'll let you know when I deploy it. I'll also update the template to use this base spec and increase the maximum allowed time to 16s.

@kazk kazk changed the title Updates for base test and debugging captuire Updates for base test and debugging capture Jan 31, 2020
@kazk kazk merged commit 68a8d51 into codewars:master Jan 31, 2020
@bdw429s
Copy link
Contributor Author

bdw429s commented Jan 31, 2020

@kazk Sweet!

What about the existing katas that need changed to use the new base test case? After this deploys should I go and suggest an edit to each kata?

@kazk
Copy link
Member

kazk commented Jan 31, 2020

I can update the existing kata when this is deployed. It's currently only 15 so it shouldn't take long. If I don't have the time to, I'll ask you to suggest and edit.

@kazk
Copy link
Member

kazk commented Feb 1, 2020

I just deployed to production and updated existing 15 CFML challenges.
The template is also updated, but there might be some pending translations that's not using the new base spec. Please let the translator know if you find them.

@bdw429s
Copy link
Contributor Author

bdw429s commented Feb 1, 2020

The template is also updated,

@kazk I just started a brand new CFML translation for Grasshopper - Messi goals function and the sample test boxes still showed code that extended testbox.system.BaseSpec instead of CodewarsBaseSpec.

@kazk
Copy link
Member

kazk commented Feb 1, 2020

Hmm, I just tried new translation and it showed CodewarsBaseSpec.
Have you refreshed the page since the update? Maybe you have outdated application.js that contains the template snippet.

@bdw429s
Copy link
Contributor Author

bdw429s commented Feb 1, 2020

Yep, that was it. I've probably had this Codewars browser window open for several days 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants