PennController for IBEX › Forums › Support › Issue Importing Images After Test.Is() › Reply To: Issue Importing Images After Test.Is()
![](https://www.pcibex.net/wp-content/uploads/2018/10/IMG_8365-e1540835663655-150x150.jpg)
We resolved this issue by email
The problem was coming from the assumption that newImage commands embedded in the success would only be evaluated in case of a successful test, but all new* commands are evaluated at the beginning of the experiment, even if they are embedded in a test command that will be evaluated upon runtime. One reason for this behavior is to let PennController preload the resources as soon as possible.
In this case, the solution was to carry out the same tests using javascript’s ternary conditional, which will effectively include the PennController commands in Template only if the test is successful, like this:
Template( "myTable.csv" , row => newTrial( "trial" ( row.Image.match(/png$/) ? newImage( row.Image ).print() : newText( row.Text ).print() ) , newButton("Next").print().wait() ) )
Jeremy