Flutter: how to load file for testing

Just had a go at this and it’s easier than you might expect. First, create a folder that lives in the same directory than your tests are. For example, I created a folder called test_resources. Then, let’s say we have the following JSON file for testing purposes. test_resources/contacts.json { “contacts”: [ { “id”: 1, “name”: … Read more

How do you configure babel to run with different configurations in different environments

Set up different environments in your .babelrc { “env”: { “dev”: { “presets”: [“es2015”], “plugins”:[“x”] }, “test”: { “presets”: [“es2015”] } } } And then run babel after you have set your BABEL_ENV BABEL_ENV=test <commandhere> or BABEL_ENV=dev <commandhere> If you don’t set BABEL_ENV, babel will use the NODE_ENV value. If you don’t set either BABEL_ENV … Read more

Developing and Testing a Facebook application

Try updating your hosts file (for windows users @ c:\windows\System32\Drivers\etc\hosts) with an entry that will route all requests from your live domain back to your machine. So 127.0.0.1 mywebappthatusesfacebook.com. Then make sure that your app is running at the root of your webserver. @ http://localhost/ Then goto mywebappthatusesfacebook.com in your browser and it should redirect … Read more

How to test Go function containing log.Fatal()

This is similar to “How to test os.Exit() scenarios in Go”: you need to implement your own logger, which by default redirect to log.xxx(), but gives you the opportunity, when testing, to replace a function like log.Fatalf() with your own (which does not call os.Exit(1)) I did the same for testing os.Exit() calls in exit/exit.go: … Read more

Testing software: fake vs stub

I assume you are referring to the terminology as introduced by Meszaros. Martin Fowler does also mentions them regularly. I think he explains the difference pretty well in that article. Nevertheless, I’ll try again in my own words 🙂 A Fake is closer to a real-world implementation than a stub. Stubs contain basically hard-coded responses … Read more