Skip to content

Commit

Permalink
adding in generic test libraries and converted trim_reads tests to us…
Browse files Browse the repository at this point in the history
…e them
  • Loading branch information
necrolyte2 committed Feb 8, 2016
1 parent d2f8421 commit 14c1698
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ target/
*~
*.swp
*.swo

# Project ignores
tests/testoutput
23 changes: 23 additions & 0 deletions tests/common_robot.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,26 @@ Directory Should Have Items
[Arguments] ${path} @{expected}
${items} = List Directory ${path}
Lists Should Be Equal ${items} ${expected}

Run JIP Tool And Return RC And Output
[Arguments] ${cmdline} ${expected_rc}=0 ${jipdb}=${TESTOUTPUTDIR}/jip.db ${log_to_console}=True

This comment has been minimized.

Copy link
@averagehat

averagehat Feb 8, 2016

Contributor

should this be expected_rc=0?

This comment has been minimized.

Copy link
@necrolyte2

necrolyte2 Feb 8, 2016

Author Member

it seems to work the way it is written, but I am still learning all this robot crazyness so it could be wrong

${result} = Run Process ${cmdline} shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Run Keyword If ${log_to_console} Log To Console ${result.stdout}
Should Be Equal As Integers ${result.rc} ${expected_rc}
[return] ${result.rc} ${result.stdout}

Ensure Tool Accepts Stdin And Outputs Stdout
[Arguments] ${tool_and_options} ${input_contents} ${expected_contents}
${in_fastq} = Set Variable ${TESTOUTPUTDIR}/input.fastq
${out_fastq} = Set Variable ${TESTOUTPUTDIR}/output.fastq
Create File ${in_fastq} ${input_contents}
${rc} ${stdout} = Run Jip Tool And Return RC And Output cat ${in_fastq} | ${tool_and_options} | cat > ${out_fastq}
Log To Console ${stdout}
Should Be Equal As Integers ${rc} 0
Verify File ${out_fastq} ${expected_contents}

Normalized Input And Output Usage Statement
[Arguments] ${tool}
${rc} ${stdout} = Run JIP Tool And Return RC And Output ${tool} --help expected_rc=1
Should Contain ${stdout} [<input>] [-p]
Should Contain ${stdout} [<input>]
40 changes: 15 additions & 25 deletions tests/trim_reads.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,50 +14,40 @@ ${fastq_content} @trimid\nNNNNNNNNNNAAAAAAAAAANNNNNNNNNN\n+\n5555555
${interleave_content} ${fastq_content}\n${fastq_content}
${in_fastq} = ${TESTOUTPUTDIR}/trim_me.fastq
${testout} = ${TESTOUTPUTDIR}/output
${trimmed_fq} = @trimid\nAAAAAAAAAA\n+\nIIIIIIIIII
${out_fastq} = ${trimmed_fq}\n${trimmed_fq}\n
${trimmed_fq} = @trimid\nAAAAAAAAAA\n+\nIIIIIIIIII\n
${out_fastq} = ${trimmed_fq}${trimmed_fq}
${tool} = ${jip_path}/trim_reads.jip
${jipdb} = ${TESTOUTPUTDIR}/jip.db

*** Test Cases ***
# Normal execution
trim_reads paired trims Ns
Create File ${in_fastq} ${interleave_content}
${result} = Run Process ${tool} ${in_fastq} -p -o ${testout}.fastq -t shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Log To Console ${result.stdout}
Should Contain ${result.stdout} --trim-n is not supported at this time
#Should Be Equal As Integers ${result.rc} 0
#Verify File ${testout}.fastq ${out_fastq}
${rc} ${stdout} = Run JIP Tool And Return RC And Output ${tool} ${in_fastq} -p -o ${testout}.fastq -t expected_rc=1
Should Contain ${stdout} --trim-n is not supported at this time

trim_reads paired trims low quality
Create File ${in_fastq} ${interleave_content}
${result} = Run Process ${tool} ${in_fastq} -p -o ${testout}.fastq -q 25 30 shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Log To Console ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
${rc} ${stdout} = Run JIP Tool And Return RC And Output ${tool} ${in_fastq} -p -o ${testout}.fastq -q 25 30
Verify File ${testout}.fastq ${out_fastq}

trim_reads paired removes bases
Create File ${in_fastq} ${interleave_content}
${result} = Run Process ${tool} ${in_fastq} -p -o ${testout}.fastq -x 10 -10 shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Log To Console ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
${rc} ${stdout} = Run JIP Tool And Return RC And Output ${tool} ${in_fastq} -p -o ${testout}.fastq -x 10 -10
Verify File ${testout}.fastq ${out_fastq}

trim_reads paired accepts interleave input
Create File ${in_fastq} ${interleave_content}
${result} = Run Process ${tool} ${in_fastq} -p -o ${testout}.fastq -x 10 -10 shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Log To Console ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
Verify File ${testout}.fastq ${out_fastq}
trim_reads paired accepts unpaired input
Create File ${in_fastq} ${fastq_content}
${rc} ${stdout} = Run JIP Tool And Return RC And Output ${tool} ${in_fastq} -p -o ${testout}.fastq -x 10 -10
Verify File ${testout}.fastq ${trimmed_fq}

trim_reads handles stdin/stdout pipe
Create File ${in_fastq} ${interleave_content}
${result} = Run Process cat ${in_fastq} | ${tool} -x 10 -10 | cat > ${testout}.fastq shell=True stderr=STDOUT env:JIP_DB=${jipdb}
Log To Console ${result.stdout}
Should Be Equal As Integers ${result.rc} 0
Verify File ${testout}.fastq ${out_fastq}

Ensure Tool Accepts Stdin And Outputs Stdout ${tool} -x 10 -10 ${interleave_content} ${out_fastq}
# End Normal execution

# Ensure normalized usage statements
trim_reads supports input and output
Normalized input And Output Usage Statement ${tool}

# Expected failures
# End Expected failures

0 comments on commit 14c1698

Please sign in to comment.