# Tests success on local but fails in Travis CI

**URL:** <https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382>\
**Category:** General Usage\
**Created:** [July 14, 2018, 10:32pm UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382 "2018-07-14T22:32:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrtkp9993](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrtkp9993/32/2728_2.png) [@mrtkp9993](https://discourse.julialang.org/u/mrtkp9993)\
**Post date:** [July 14, 2018, 10:32pm UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382/1 "2018-07-14T22:32:07Z")

</div>

Hi All!  
The question is in title. I had this error on travis:

```julia
Error During Test
  Test threw an exception of type MethodError
  Expression: countBases(readStringFromFile(joinpath(@ __DIR__ (), "data", "rosalind_dna.txt"))) == (201, 182, 223, 195)
  MethodError: Cannot `convert` an object of type Type{String} to an object of type Array{UInt8,1}
  This may have arisen from a call to the constructor Array{UInt8,1}(...),
  since type constructors fall back to convert methods.
  Stacktrace:
   [1] read(::IOStream, ::Type{T} where T) at ./io.jl:528
   [2] open(::Bioinformatics.##3#4, ::String) at ./iostream.jl:152
   [3] readStringFromFile(::String) at /home/travis/.julia/v0.6/Bioinformatics/test/../src/Bioinformatics.jl:80
   [4] include_from_node1(::String) at ./loading.jl:576
   [5] include(::String) at ./sysimg.jl:14
   [6] process_options(::Base.JLOptions) at ./client.jl:305
   [7] _start() at ./client.jl:371
ERROR: LoadError: There was an error during testing
while loading /home/travis/.julia/v0.6/Bioinformatics/test/runtests.jl, in expression starting on line 38

```

Code is here: [Bioinformatics.jl/Bioinformatics.jl at master · mrtkp9993/Bioinformatics.jl · GitHub](https://github.com/mrtkp9993/Bioinformatics.jl/blob/master/src/Bioinformatics.jl)  
Also you can fix it and create a pull request.

Thank you.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [July 15, 2018, 4:36am UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382/2 "2018-07-15T04:36:48Z")

</div>

`read(f, String)` is only possible on Julia v0.7. I’m guessing you’re running Julia v0.6 on Travis.

---

<div class="post-metadata">

**Author:** ![mrtkp9993](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrtkp9993/32/2728_2.png) [@mrtkp9993](https://discourse.julialang.org/u/mrtkp9993)\
**Post date:** [July 15, 2018, 5:43am UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382/3 "2018-07-15T05:43:06Z")

</div>

But I’m using 0.6.2.2 on local, not 0.7.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [July 15, 2018, 5:44am UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382/4 "2018-07-15T05:44:08Z")

</div>

Are you using Compat locally?

---

<div class="post-metadata">

**Author:** ![mrtkp9993](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mrtkp9993/32/2728_2.png) [@mrtkp9993](https://discourse.julialang.org/u/mrtkp9993)\
**Post date:** [July 15, 2018, 7:03am UTC](https://discourse.julialang.org/t/tests-success-on-local-but-fails-in-travis-ci/12382/5 "2018-07-15T07:03:00Z")

</div>

I think I found my problem.  
Firstly ,I changed my local Julia version to 0.7.  
In my `readFile` method, I’m using `strip` function that returns a substring. But my `countBases` function expects a `String`, not a substring.

```julia
$ julia runtests.jl 
Error During Test at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:57
  Test threw exception MethodError(Main.Bioinformatics.countBases, ("ATACTTGGCCCAAGGCTTTCCGCAACGATTGGTCAGGCTTTACTGCGCGCTTATTAGGCTTCGAGTCCAGACATGCGACGTAAATACGATGAGGGTCTACTGATCAGTCTAAATGGGAGAGTCAGCGAGGATTGCGTCTTGACGATCAAATTAGTGAGGGAGGCGTTGCTCGCGATTTTTCCGTTCAATGTACGACATCGTATCATTGACCTTTACGTAATTCAGAGACCGGAACGGAGTGGTTACCACTGACGCTAACGCAGGTAGGAGACGCGAATCAATTCCGACCGCCGCGTAGAGGGGCGTTAACGCGGAAAGAACGCACCAATGCTAGCTGTTTATTAAGCCTTTCGTGAGATAAAGTACAACAACCGCCAGGCCCAGTTCAAGCAAACTAGCTAACGAGCGCTGCTCCGTCGATATATCTATGACCGTGCCTTGAATGCGCTCATGGGTCGCAAGACGGGAAGGGTTAGCCGAGAAATTGATCTGATACACACACTGCCGACTCTGGCGTTGAGTCTGTTCGGTAATGCCAGGCCCACGATGCCTCTAATAGAGCACGTTACTTGGCACGGCGGAGCCGATGTCTAGGATCATCAGGCTGTTGGAGTAACAAATTAAGTTTAAAGACGCCTTTGCCTGTATGTCCTTTAGGCGATTGCTCGTAGGCACAGTTGCGAGTCTCGACCCTATGTTGGAAGAGGAGCAAGGGACCGTGTATCCCAGTCTAGGCGATGTGGTAGGGTAAGTTTGAGCCTGTTCGTGACTCTCGCATACATAAGGAGTAGGAAATGGTTC",), 0x0000000000006bbc)
  Expression: Bioinformatics.countBases(Bioinformatics.readStringFromFile(joinpath(#= /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:59 =# @ __DIR__ (), "data", "rosalind_dna.txt")))
  MethodError: no method matching countBases(::SubString{String})
  Closest candidates are:
    countBases(!Matched::String) at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/src/Bioinformatics.jl:92
  Stacktrace:
   [1] top-level scope at none:0
   [2] include at ./boot.jl:317 [inlined]
   [3] include_relative(::Module, ::String) at ./loading.jl:1034
   [4] include(::Module, ::String) at ./sysimg.jl:29
   [5] exec_options(::Base.JLOptions) at ./client.jl:234
   [6] _start() at ./client.jl:427
ERROR: LoadError: There was an error during testing
in expression starting at /Users/muratkoptur/Desktop/github/Bioinformatics.jl/test/runtests.jl:57

```

Edit: Done. I used `String(strip(...))` and problem solved.
