Testing as I Go -- But how?

Hi, everyone!

I know this question has probably been asked a hundred thousand times, but I’ve been pouring over the forums and the wiki and the website for some days now, and I’m still not clear on the answer. So I apologize for asking again, but I’m hoping I can get some good advice.

Essentially, I’m finding that the longer my story gets the more difficult it is for me to keep up with making sure everything runs smoothly. Plus, every time I make a small code change and want to see if that did the trick to fix a problem, I have to play the whole game up up to that point. It gets pretty frustrating!

So what do you guys recommend? How do you test as you go along in a way that doesn’t start to drive you batty?

Thanks so much!

I just use quicktext.html open in firefox or other browser voila, not need wrote anything lol only click in quick text . So all people could click the file i havent pc and could use it. Even works offline best invent ever

I copied small amounts of code into https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/online-cs-tester/mygame/input.html and tested that way.

http://www.choiceofgames.com/forum/discussion/1213/tool-online-choicescript-tester is the thread for the online tester. The side by side version is my favourite, admittedly.

You do need to set up any variables as temp variables if you’re using just chunks of the code, but I find that also helps me work out if the issue is with my variables.

I also tend to make my code very simplistic. I find nested choices extremely difficult to follow, so I don’t even attempt to do those.

Oh, I think you pointed that out to me before, and it’s extremely useful! But, whenever there are global variables that would have to then become temp ones to test in that manner, it starts to become less practical.

Do you use the other testers as you code? The quicktest one and the randomtest one? If you use them frequently, as well as the online tester, it shouldn’t be too hard to get the majority of the bugs.

It’s my first game attempt so my code is definitely not overly complicated. Most of my problems at this point seem to be indentation-related or small syntax errors. I think it will get easier with practice.

I’m having some trouble figuring out how to use those, actually.

Shortcuts in your game? In my current working draft, I’ve written five choices “Are you male?” “Are you noble?” etc. and then a shortcut dumping me in the middle of Ch 1.

Do you use the quicktest.html and randomtest.html files for testing?

Do you use tabs or spaces for indentation?
Do you use notepad++

I’m not sure how to use quicktest.html and randomtest.html for testing. The info I can find on testing seems to be from http://www.choiceofgames.com/make-your-own-games/testing-choicescript-games-automatically/ so I’m probably missing something important. I use tabs for indentation and Sublime Text 2 as my extremely helpful editor.

I’m not sure how to use them either. I just use CJW’s tester. I gave up with the quicktest/randomtest because it confused me. The .html files are supposed to be easier to use, but I’ve not used them myself. I don’t even have a copy of choicescript on my new computer yet. I think that page is outdated since it doesn’t have any mention of the .html files for testing.

I use tabs for indents too, since I find them easier to keep track of than spaces. And I’m sure your text editor is great, so that won’t help too much.

So, FairyGodfeather, I’m going to try your advice and use the tester a bit more often, for now even though it seems like it might just be a different kind of time-consuming. Thank you for all your patient recommendations!

Havenstone, thank you for your suggestion too. I’m not sure how I would work in shortcuts since I’ve incorporated “chargen” slowly over the first two chapters rather than all at once in the beginning. I might end up using some shortcuts later on, however!

@Shula I find that quicktest and autotest are generally pretty handy for catching little things like indentation problems. To run them, I right click on the overall file that has my game in it (for me it’s the dfabulich… one) and select “open command prompt here.” Then I type in autotest.bat or quicktest.bat and it runs. I’m not sure if that’s how you’re supposed to do it or not, but it works for me.

I’ve also got my chargen spread through the first two chapters. What I’m suggesting is if you’re editing Ch 3, write a bit of code that is just the key chargen choices – no narrative fluff – and end it with a *goto that takes you to the beginning of Ch 3 (or whatever point in the chapter you’re testing). Paste that “shortcut” code at the beginning of the game. Then instead of reading through everything, you just quickly click through the key choices and jump to whatever bit you’re testing at the moment. Cut the shortcut code out when you want to read through the whole game again.

To sort of elaborate on what @Havenstone has said,

For targeted scene testing, I use some code I read about somewhere, can’t remember who to credit it to though, so sorry (maybe it was Havenstone!). Essentially, what you do is, have a choice at the beginning of startup.txt that asks if you want to play as normal or in alpha testing mode. Like this:


*title <name of your game>
*scene_list
  <your scenes go here>

*create alpha_testing true
<your variables go here>

*if (alpha_testing)
  *comment TESTING CODE STARTS
  *choice
    #Alpha Test Mode
      *goto test_start
    #Normal Mode
      *goto normal_start
  *label test_start
 <copy all of your variables here, then *set them as you need them to be for the test>
  
  *goto_scene <whatever scene you want to test>
  
  *comment TESTING CODE ENDS

*label normal_start
<normal game code goes here>

So you simply include this block at the beginning of your game, and you can tweak the stats to be whatever you want them to be, then you determine which scene you want to test, and go there. If you need to go to a specific part of a scene, you can just include another label in that file, and say this at the top:


*if (alpha_testing)
  *goto test_start1

I wouldn’t recommend this unless you’re experienced and understand everything that’s going on. It’s pretty simple once you get it, but it could break your game if you don’t do it right. Also, with that second block, you may need to place it after you’ve created your temp variables for the scene, or it could also cause problems.

Then, when you release the game, you can delete the alpha testing block so that no one accidentally jumps to the last section you were testing.