# Help to create tests for apparently an untestable package

**URL:** <https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386>\
**Category:** General Usage\
**Created:** [February 2, 2019, 9:24pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386 "2019-02-02T21:24:53Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [February 2, 2019, 9:24pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/1 "2019-02-02T21:24:53Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![StevenSiew](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevensiew/32/218393_2.png) [@StevenSiew](https://discourse.julialang.org/u/StevenSiew)\
**Post date:** [February 2, 2019, 10:23pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/2 "2019-02-02T22:23:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [February 2, 2019, 11:32pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/3 "2019-02-02T23:32:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![00vareladavid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00vareladavid/32/23521_2.png) [@00vareladavid](https://discourse.julialang.org/u/00vareladavid)\
**Post date:** [February 3, 2019, 2:04am UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/4 "2019-02-03T02:04:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [February 3, 2019, 2:04am UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/5 "2019-02-03T02:04:57Z")

</div>

Yeah! Tomorrow I will have the first commit!

---

<div class="post-metadata">

**Author:** ![oxinabox](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oxinabox/32/206603_2.png) [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Post date:** [February 3, 2019, 5:32am UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/6 "2019-02-03T05:32:27Z")

</div>

Mocking.jl

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [February 3, 2019, 6:13pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/7 "2019-02-03T18:13:20Z")

</div>

Hi guys,

This is the package I want to add tests: [GitHub - ronisbr/TextUserInterfaces.jl: Text user interfaces for Julia](https://github.com/ronisbr/TextUserInterfaces.jl)

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

> **[Travis CI - Test and Deploy with Confidence](https://app.travis-ci.com/ronisbr/TextUserInterfaces.jl/builds/488201840)**
>
> Travis CI enables your team to test and ship your apps with confidence. Easily sync your projects with Travis CI and you'll be testing your code in minutes.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [February 3, 2019, 6:29pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/8 "2019-02-03T18:29:00Z")

</div>

Something like [this](https://github.com/azawawi/perl6-ncurses/blob/master/.travis.yml#L11-L21) should install `ncurses` for you. Also have a look at [`TerminalRegressionTests.jl`](https://github.com/Keno/TerminalRegressionTests.jl) for testing (not sure how well it works atm though).

---

<div class="post-metadata">

**Author:** ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Post date:** [February 3, 2019, 6:34pm UTC](https://discourse.julialang.org/t/help-to-create-tests-for-apparently-an-untestable-package/20386/9 "2019-02-03T18:34:21Z")

</div>

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

```julia
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

```
