vendredi 27 septembre 2019

How are fcgi scripts tested?

I am a newbie so forgive me if this sounds naive. I wrote a script in fastcgi++. And I tested the basic use cases. But like a good software engineer I want to test the script every time I make a change to make sure I don't break things.

This was what I used to do:

This was my directory structure:

script:

 - bin 
 - build (contained the bash script to compile the script)
 - src
 - tests  
    - build (contained bash script to compile the test)
    - src (contained the test file)
    - output

I hacked the way I tested. I used to use curl to call my script and redirect its output to a file in tests/output (using relative path) and compare it with the expected output. I could do that because the tests were compiled by hand and I only executed the tests after changing the directory to tests/build. I recently decided to use a build system. I chose meson. The way you test using meson is by running meson test or ninja test. The problem is now I do not control from where the test is run.

How to test in such circumstance? And how you test your fcgi scripts?

Aucun commentaire:

Enregistrer un commentaire