Re: Unit Testing Custom Language Generator

37 views
Skip to first unread message
Message has been deleted

Maribeth Bottorff

unread,
May 3, 2023, 10:52:02 PM5/3/23
to Blockly
Hello Conor,

We also have generator tests in Blockly defined here: https://github.com/google/blockly/tree/develop/tests/generators

The basic idea is just load some blocks into a workspace, convert the workspace to code, and check that the code matches your expected value. That should give you a starting point and you can always add more detailed or granular tests from there.

Maribeth

On Tuesday, May 2, 2023 at 6:30:06 PM UTC-7 conorke...@gmail.com wrote:
Hi guys, 

I'm producing a Programming environment for Embedded C using the Blockly framework as a final year project for UNI. As part of the project I need to preform testing on my code and I came across a video Test Helpers on the Blockly YT channel.

I was particularly interested in the Code Generation Tests chapter as I would like to test all of my custom block generators. 

I've read the Unit Testing Docs, analysed the Mocha Tests in Blockly Core and played around with the Dev-tools plugin but I still don't know where to start.

I just want to write some test that check if a particular block returns the expected code.

Regards
Conor

P.S 
Sorry for bombarding you all with questions 
Reply all
Reply to author
Forward
0 new messages