# Conditional code for quicktest

**URL:** <https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246>\
**Category:** Game Development\
**Created:** [August 26, 2020, 8:38pm UTC](https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246 "2020-08-26T20:38:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![choicehacker](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/choicehacker/32/127936_2.png) [@choicehacker](https://forum.choiceofgames.com/u/choicehacker)\
**Post date:** [August 26, 2020, 8:38pm UTC](https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246/1 "2020-08-26T20:38:04Z")

</div>

My game has some code that I’d like to skip in tests (e.g slow recursive algorithms). For random tests, I can easily do

```
*if not(choice_randomtest)

```

While there is a similar variable called choice\_quicktest, my code seems to be executed during quicktest even if I guard with a check

`*if not(choice_quicktest)`

Does anybody have any suggestions? Thanks!

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [August 27, 2020, 1:02am UTC](https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246/2 "2020-08-27T01:02:46Z")

</div>

QuickTest “cheats” and checks every outcome of a conditional, even if it’s impossible to reach it, so no, I don’t think so.

You _might_ be able to work around it by saying \*if choice\_quicktest, \*goto somewhereelsethatavoidsrunningmycode… But I wouldn’t be surprised if it still tried to execute the rest.

---

<div class="post-metadata">

**Author:** ![choicehacker](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/choicehacker/32/127936_2.png) [@choicehacker](https://forum.choiceofgames.com/u/choicehacker)\
**Post date:** [August 27, 2020, 7:00pm UTC](https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246/3 "2020-08-27T19:00:44Z")

</div>

Thanks @CJW. Something that works is that, if you do \*if choice\_quicktest, the code will be taken by quicktest, and not by the actual game. Still, there is apparently no way to exclude code in quicktest.

BTW, I fail to understand how that happens, as I don’t see an override to Scene.prototype[“if”] or Scene.prototype[“else”] in autotest.js. Do you know how quicktest follows both branches?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [August 27, 2020, 7:51pm UTC](https://forum.choiceofgames.com/t/conditional-code-for-quicktest/85246/4 "2020-08-27T19:51:18Z")

</div>

AFAIK (not spent a great deal of time analyzing it), QuickTest doesn’t actually “execute” your code, it just scans it.
