Skip to content

Commit

Permalink
FEATURE: More testing files for LMEDS
Browse files Browse the repository at this point in the history
  • Loading branch information
timmahrt committed May 16, 2016
1 parent 84c18dc commit ed4c360
Show file tree
Hide file tree
Showing 11 changed files with 232 additions and 34 deletions.
24 changes: 24 additions & 0 deletions integration_tests/base_demo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'''
Created on May 16, 2016
@author: tmahrt
'''

import os
from os.path import join
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)

from lmeds import rpt_main

leafFolder = "lmeds_demo"
sequenceFile = "sequence.txt"
languageFile = "english.txt"
disableRefresh = False
audioExtList = [".ogg", ".mp3"]

survey = rpt_main.WebSurvey(leafFolder, sequenceFile, languageFile,
disableRefresh, audioExtList=audioExtList)
43 changes: 14 additions & 29 deletions integration_tests/lmeds_virtual_demo.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
'''
Created on Apr 29, 2016
@author: Tim
'''

import os
from os.path import join
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)

from lmeds import rpt_main

leafFolder = "lmeds_demo"
sequenceFile = "sequence.txt"
languageFile = "english.txt"
disableRefresh = False
audioExtList = [".ogg", ".mp3"]

survey = rpt_main.WebSurvey(leafFolder, sequenceFile, languageFile,
disableRefresh, audioExtList=audioExtList)

for i in range(survey.testSequence.getNumPages()):
page = survey.testSequence.getPage(i)
survey.buildPage(i, "", page, "no_name", survey.testSequence,
survey.sourceCGIFN)
'''
Created on Apr 29, 2016
@author: Tim
'''

import base_demo

survey = base_demo.survey

for i in range(survey.testSequence.getNumPages()):
page = survey.testSequence.getPage(i)
survey.buildPage(i, "", page, "no_name", survey.testSequence,
survey.sourceCGIFN)
8 changes: 3 additions & 5 deletions integration_tests/test/integration_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@

class IntegrationTests(unittest.TestCase):
"""Integration tests"""

def test_run_lmeds_demo(self):
"""Running 'lmeds_virtual_demo'"""
print(os.getcwd())
import lmeds_virtual_demo
print(os.getcwd())
print("bloop")




if __name__ == '__main__':
unittest.main()
35 changes: 35 additions & 0 deletions integration_tests/test/user_script_it_gen_dictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'''
Created on Apr 29, 2016
@author: tmahrt
Runs integration tests
The examples were all written as scripts. They weren't meant to be
imported or run from other code. So here, the integration test is just
importing the scripts, which causes them to execute. If the code completes
with no errors, then the code is at least able to complete.
Testing whether or not the code actually did what it is supposed to is
another issue and will require some refactoring.
'''

import unittest
import os
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)
os.chdir(_root)

class UserScriptIntegrationTests(unittest.TestCase):
"""Integration tests"""

def test_gen_dictionary(self):
"""Running 'lmeds_virtual_demo'"""
import user_script_gen_dictionary


if __name__ == '__main__':
unittest.main()
34 changes: 34 additions & 0 deletions integration_tests/test/user_script_it_get_duration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'''
Created on Apr 29, 2016
@author: tmahrt
Runs integration tests
The examples were all written as scripts. They weren't meant to be
imported or run from other code. So here, the integration test is just
importing the scripts, which causes them to execute. If the code completes
with no errors, then the code is at least able to complete.
Testing whether or not the code actually did what it is supposed to is
another issue and will require some refactoring.
'''

import unittest
import os
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)
os.chdir(_root)

class UserScriptIntegrationTests2(unittest.TestCase):
"""Integration tests"""
def test_get_duration(self):
"""Running 'get_duration_demo'"""
import user_script_get_duration


if __name__ == '__main__':
unittest.main()
34 changes: 34 additions & 0 deletions integration_tests/test/user_script_it_post_process.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'''
Created on Apr 29, 2016
@author: tmahrt
Runs integration tests
The examples were all written as scripts. They weren't meant to be
imported or run from other code. So here, the integration test is just
importing the scripts, which causes them to execute. If the code completes
with no errors, then the code is at least able to complete.
Testing whether or not the code actually did what it is supposed to is
another issue and will require some refactoring.
'''

import unittest
import os
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)
os.chdir(_root)

class UserScriptIntegrationTests3(unittest.TestCase):
"""Integration tests"""
def test_post_process(self):
"""Running 'get_duration_demo'"""
import user_script_post_process


if __name__ == '__main__':
unittest.main()
34 changes: 34 additions & 0 deletions integration_tests/test/user_script_it_sequence_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
'''
Created on Apr 29, 2016
@author: tmahrt
Runs integration tests
The examples were all written as scripts. They weren't meant to be
imported or run from other code. So here, the integration test is just
importing the scripts, which causes them to execute. If the code completes
with no errors, then the code is at least able to complete.
Testing whether or not the code actually did what it is supposed to is
another issue and will require some refactoring.
'''

import unittest
import os
import sys

cwd = os.path.dirname(os.path.realpath(__file__))
_root = os.path.split(cwd)[0]
sys.path.append(_root)
os.chdir(_root)


class UserScriptIntegrationTests4(unittest.TestCase):
"""Integration tests"""
def test_sequence_check(self):
"""Running 'get_duration_demo'"""
import user_script_sequence_check

if __name__ == '__main__':
unittest.main()
13 changes: 13 additions & 0 deletions integration_tests/user_script_gen_dictionary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'''
Created on Apr 29, 2016
@author: Tim
'''

import base_demo
from lmeds.user_scripts import generate_language_dictionary

generate_language_dictionary.generateLanguageDictionary("update", "LMEDS_DEMO",
"sequence.txt",
"english.txt"
)
19 changes: 19 additions & 0 deletions integration_tests/user_script_get_duration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'''
Created on Apr 29, 2016
@author: Tim
'''

from os.path import join

import base_demo
from lmeds.user_scripts import get_test_duration
from lmeds.io import sequence
from lmeds.utilities import constants

survey = base_demo.survey

rootPath = join(constants.rootDir, "tests", "LMEDS_Demo")
tmpSequence = sequence.TestSequence(None, join(rootPath, "sequence.txt"))
fullPath = join(rootPath, "output", tmpSequence.sequenceTitle)
get_test_duration.printTestDuration(fullPath)
10 changes: 10 additions & 0 deletions integration_tests/user_script_post_process.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
'''
Created on Apr 29, 2016
@author: Tim
'''

import base_demo
from lmeds.user_scripts import post_process_results

post_process_results.postProcessResults("LMEDS_Demo", "sequence.txt", True)
12 changes: 12 additions & 0 deletions integration_tests/user_script_sequence_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'''
Created on Apr 29, 2016
@author: Tim
'''

import base_demo
from lmeds.user_scripts import sequence_check

survey = base_demo.survey

sequence_check.checkSequenceFile(survey)

0 comments on commit ed4c360

Please sign in to comment.