Automating Testing

Most of the commits you will make to the srcFacts project should not change the program’s behavior. We expect the report to look the same after these changes. You can do this manually by verifying the results every time you build and run the program.

You can also automate this.

Generate: Generate Demo

First, starting before you make your code changes, create a file with the report in the proper format/results:

./srcFacts < demo.xml > demo.md

Now we have a file, demo.md, with the report in the proper format. To view this report:

cat demo.md

Use

Now make a code change. To see if your code change altered the behavior of the program:

./srcFacts < demo.xml | diff demo.md -

If this comes back empty, then your code changes did not alter the behavior of the program. You can enter this command every time you need to. No Change Demo

If this finds a difference, then your code changes did alter the behavior of the program. Change Demo

You only need to generate demo.md when the behavior of the program changes (e.g., you add another count).

How this works:

More Automation:

So you don’t to type that command every time in the shell: