When you "Run Code" directly from the code editor there simply is no Test Suite available. Hence null. This is normal behaviour. You need to test for this scenario and cope somehow that suits your needs. I assume default values when the Test Suite isn't available, for example.