Help to create tests for apparently an untestable package


#1

Hi guys!

As I mentioned before, I am creating a package to built TUIs using Ncurses. My problem is: how can I develop tests? It seems that it is not possible since all the things needs interactions with the user and read what is on the screen. Can anyone help me?


#2

Write a ncurse code.
Direct the output to a text file.
Compare the text file with a fixed text file.
If the two files are identical, then the test is a success!
Otherwise the test is a failure.


#3

I have now idea how can I do this inside Julia with the test framework. Can you please help me?


#4

Is it possible to set up a guthub repo for this? It makes it easier to give concrete suggestions


#5

Yeah! Tomorrow I will have the first commit!


#6

Mocking.jl


#7

Hi guys,

This is the package I want to add tests: https://github.com/ronisbr/TextUserInterfaces.jl

In Travis, I cannot even load libncurses in Linux. In macOS it works fine:

https://travis-ci.org/ronisbr/TextUserInterfaces.jl/builds/488201840


#8

Something like this should install ncurses for you. Also have a look at TerminalRegressionTests.jl for testing (not sure how well it works atm though).


#9

Thanks! I tried to install Ncurses with something like you posted without success:

before_install:
    # If it is linux, we must install `libncurses`.
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --reinstall libncurses5     libncursesw5;     fi
    - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --reinstall libncurses5-dev libncursesw5-dev; fi