✨ Project 1/Stage 3: Tetris Tested (Testris?) ✨
Due: Monday Feb 2 by 5:00pm
Overview
Now we raise the quality of our Tetris programs by adding automated testing to our dual-gravity version.
Tasks
Be sure to commit to git as you go through the tasks here. A good rule of thumb is to commit each time Claude stops interacting and is ready for a new prompt.
Separate game logic from the UI
If your current Tetris program is all in HTML, you need to split it into the game logic (in a Javascript file) and the user interface (UI, which will remain in HTML). Claude will help you do this. You can prompt it that you want to separate out the logic for purposes of testing.
Make a plan of what to test
Part of the challenge of writing automated tests is deciding what behavior to test for in the first place. We know that there is logic around pieces moving in response to key presses, clearing lines, and so on. Ideally, we would need tests for these and other behaviors of the game, but what behaviors should we include?
Plans of what to test are valuable documents that can be reviewed and assessed separately from the tests themselves. In this stage, you aren't writing actual tests yet. You are instead working out a prose document that describes the scenarios that should be tested. Work with Claude to develop a testing plan, and have Claude write it to Testing.md ("md" stands for "markdown", a simple and common format for text files -- you can view the files directly in Github or VSCode).
Be sure to make entries in your research journal about what you find as you develop your testing plan.
Create Automated Tests
Once you are satisfied with your testing plan, work with Claude to develop and run the actual tests. If you are using Claude within a tool like VSCode, Claude will offer to run the tests for you. Let it do so, but watch the resulting transcript. If Claude detects a failed test, it might start to debug the code automatically. That's fine, but make note of the bugs that it found and fixed as part of your research journal.
As bugs are found, make sure Claude is adding (regression) tests to cover the situations that it reports to have fixed. When Claude reports that it is done, think about what questions you could ask Claude to help confirm that the tests are sufficient.
Submitting
Continue submitting to your existing Tetris repo and working in your Tetris research journal.
To include the chat transcript, we want to use a newly-released tool called claude-code-transcripts. The steps to use it are as follows:
- Claude-code-transcripts runs through a program called
uv, which is a package manager for Python (a package manager is a tool that helps you install and manage code libraries for software development). There are different installation instructions for macOS/Linux versus Windows. It should install using a single command that you run in your terminal or Powershell. If you want help installing it, reach out on Ed or ask our TA, Alex. We can also help after class on Tuesday. - Once you have
uvinstalled, you can installclaude-code-transcriptsby running the commanduvx claude-code-transcriptsin your terminal or shell. This should bring up a list of titles of sessions you have had with Claude. Use the arrow keys to move to the one you want, then hitEnter. - If you have been using Claude only through the web, you might instead need to access the transcript through the command
uvx claude-code-transcripts web. - The tool will open a webpage with your transcript. Download the transcript file to your repo, and name it
transcript.html. If you have multiple transcripts for an assignment, you can name themtranscript-1.html,transcript-2.html, etc.
Grading
For this assignment, we are looking for the following:
- Code separated into model and view.
- A testing plan that covers a substantial set of core game behaviors.
- Your reflection journal includes notes on your design and implementation process.