def testRunAll(self):
     '''
     test runAll() with real input
     '''
     self.runner.runner = computeDataFilepath("./sample/python_unittest_example.py", __file__)
     stdout = self.runner.runAll()
     self.assertNotEqual(stdout, None)
예제 #2
0
 def testRunSuite(self):
     '''
     test runSuite() with real input
     '''
     self.runner.runner = computeDataFilepath("./sample/Boost_Test", __file__)
     stdout = self.runner.runSuite([])
     self.assertNotEqual(stdout, None)
예제 #3
0
 def test_runView(self):
     '''
     Runs the view to make sure nothing explodes.
     '''
     model = Model.setupModel("Boost", 
                     computeDataFilepath("../../Model/sample/Boost_Test", __file__),
                     False)
     
     from TestParser.Common.ViewFactory import ViewFactory
     ViewFactory.selectFramework("text", model)
     ViewFactory.createResultView()
     ViewFactory.startApplication()
예제 #4
0
 def test_parse(self):
     '''
     Test and validate parse with real data.
     '''
     data = open(computeDataFilepath("./sample/JUnit4_out", __file__)).read()
     
     results = self.parser.parse(stringData = data)
     
     testPass = results.getChildren()[0]
     noticePass = testPass.getChildren()[0]
     self.assertEquals(noticePass.type, "pass")
     
     suite = results.getChildren()[1]
     suiteData = suite.getRelevantDisplayData()
     self.assertTrue(('name', 'test') in suiteData)
     
     tests = suite.getChildren()
     self.assertEquals(len(tests), 3)
     
     test0 = tests[0]
     test0_data = test0.getRelevantDisplayData()
     self.assertTrue(('name', 'testTwo') in test0_data)
     notice0 = test0.getChildren()[0]
     self.assertEquals(notice0.type, 'fail')
     notice0_data = notice0.getRelevantDisplayData()
     self.assertTrue(('file', 'test.java') in notice0_data)
     self.assertTrue(('line', '21') in notice0_data)
     self.assertTrue(('info', 'java.lang.AssertionError: expected : < 5 > but was : < 4 >') in notice0_data)
     
     test1 = tests[1]
     test1_data = test1.getRelevantDisplayData()
     self.assertTrue(('name', 'TestThree') in test1_data)
     notice1 = test1.getChildren()[0]
     self.assertEquals(notice1.type, 'fail')
     notice1_data = notice1.getRelevantDisplayData()
     self.assertTrue(('file', 'test.java') in notice1_data)
     self.assertTrue(('line', '27') in notice1_data)
     self.assertTrue(('info', 'java.lang.Exception'))
     
     test2 = tests[2]
     test2_data = test2.getRelevantDisplayData()
     self.assertTrue(('name', 'testFour') in test2_data)
     notice2 = test2.getChildren()[0]
     self.assertEquals(notice2.type, 'fail')
     notice2_data = notice2.getRelevantDisplayData()
     self.assertTrue(('file', 'test.java') in notice2_data)
     self.assertTrue(('line', '33') in notice2_data)
     self.assertTrue(('info', 'java.lang.AssertionError') in notice2_data)
예제 #5
0
    def test_hierarchy(self):
        """
        Test parse with real data.
        
        Tests with sub-suites. Checks that correct hierarchy returned.
        Doesn't test that all the data (names, lines, files, etc.) are
        correct, as it would complicate the test and its already checked
        in other tests.
        """

        f = open(computeDataFilepath("./sample/boost.xml", __file__))
        results = self.parser.parse(file=f)

        lvl0 = results.getChildren()
        self.assertEquals(len(lvl0), 1)
        self.assertEquals(lvl0[0].type, "Suite")

        lvl1 = lvl0[0].getChildren()
        self.assertEquals(len(lvl1), 5)

        self.assertEquals(lvl1[0].type, "TestCase")

        self.assertEquals(lvl1[1].type, "TestCase")

        self.assertEquals(lvl1[2].type, "Suite")
        lvl2_a = lvl1[2].getChildren()
        self.assertEquals(len(lvl2_a), 2)
        self.assertEquals(lvl2_a[0].type, "TestCase")
        self.assertEquals(lvl2_a[1].type, "TestCase")

        self.assertEquals(lvl1[3].type, "Suite")
        lvl2_b = lvl1[3].getChildren()
        self.assertEquals(len(lvl2_b), 5)
        self.assertEquals(lvl2_b[0].type, "TestCase")
        self.assertEquals(lvl2_b[1].type, "TestCase")
        self.assertEquals(lvl2_b[2].type, "TestCase")
        self.assertEquals(lvl2_b[3].type, "TestCase")
        self.assertEquals(lvl2_b[4].type, "Suite")
        lvl3_a = lvl2_b[4].getChildren()
        self.assertEquals(len(lvl3_a), 1)
        self.assertEquals(lvl3_a[0].type, "TestCase")

        self.assertEquals(lvl1[4].type, "Suite")
        lvl2_c = lvl1[4].getChildren()
        self.assertEquals(len(lvl2_c), 2)
        self.assertEquals(lvl2_c[0].type, "TestCase")
        self.assertEquals(lvl2_c[1].type, "TestCase")
예제 #6
0
'''

import sys
from TestParser.Common import ComputeStatistics

try:
    from PyQt4 import uic #@UnresolvedImport
    from PyQt4 import QtGui #@UnresolvedImport
except:
    sys.exit("Failed to import PyQt4. QtResultView needs PyQt4 in order to function. Please install PyQt4 or choose another UI.")

from TestParser.Common.computeDataFilepath import computeDataFilepath

filename = "Statistic.ui"

UiClass, WidgetClass = uic.loadUiType(computeDataFilepath(filename, __file__))

class QtStatisticView(UiClass, WidgetClass):
    def __init__(self, model, controller):
        '''
        Constructor
        '''
        WidgetClass.__init__(self)
        self.setupUi(self)

        self.model = model
        self.model.registerObserver(self)

        self.controller = controller
        
예제 #7
0
Test Parser is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Test Parser.  If not, see <http://www.gnu.org/licenses/>.
'''

from PyQt4 import uic #@UnresolvedImport
from PyQt4 import QtGui #@UnresolvedImport
from TestParser.Common.computeDataFilepath import computeDataFilepath
import sys


UiClass, WidgetClass = uic.loadUiType(computeDataFilepath("./About.ui", __file__))


class About(UiClass, WidgetClass):
    '''
    About box.

    @date Mar 13, 2010
    @author Matthew A. Todd
    '''

    def __init__(self):
        '''
        Constructor
        '''
        WidgetClass.__init__(self)
예제 #8
0
 def test_parseString(self):
     f = open(computeDataFilepath("./sample/JUnit4_out", __file__))
     self.parser.parse(stringData = f.read())
예제 #9
0
 def test_parseFile_4(self):
     f = open(computeDataFilepath("./sample/JUnit4_out", __file__))
     self.parser.parse(file = f)
예제 #10
0
 def setUp(self):        
     self.model = Model.setupModel("Boost",
                         computeDataFilepath('../Model/sample/Boost_Test', __file__),
                         False)
 def test_Parse(self):
     '''
     Test and validate with real data.
     
     Everything is hardcoded. I did this b/c its easy, fast, simple and
     provides unobfuscated documentation.
     
     @date Jul 13, 2010
     '''
     data = open(computeDataFilepath("./sample/python_unittest_sample", __file__)).read()
     
     results = self.parser.parse(stringData = data)
     
     suites = results.getChildren()
     self.assertEquals(len(suites), 1)
     
     suite = suites[0]
     suiteData = suite.getRelevantDisplayData()
     self.assertTrue(('name', '__main__') in suiteData)
     
     subSuites = suite.getChildren()
     self.assertEqual(len(subSuites), 1)
     
     subSuite = subSuites[0]
     subSuiteData = subSuite.getRelevantDisplayData()
     self.assertTrue(('name', 'TestSequenceFunctions') in subSuiteData)
     
     tests = subSuite.getChildren()
     self.assertEqual(len(tests), 5)
     
     test0 = tests[0]
     test0_data = test0.getRelevantDisplayData()
     self.assertTrue(('name', 'test_choice') in test0_data)
     notice0 = test0.getChildren()[0] 
     self.assertEquals(notice0.type, "ok")
     
     test1 = tests[1]
     test1_data = test1.getRelevantDisplayData()
     self.assertTrue(('name', 'test_error') in test1_data)
     notice1 = test1.getChildren()[0]
     self.assertEquals(notice1.type, "error")
     notice1_data = notice1.getRelevantDisplayData()
     self.assertTrue(('file', 'python_unittest_example.py') in notice1_data)
     self.assertTrue(('line', '43') in notice1_data)
     self.assertTrue(('info', "NotImplementedError") in notice1_data)
     
     test2 =tests[2]
     test2_data = test2.getRelevantDisplayData()
     self.assertTrue(('name', 'test_fail') in test2_data)
     notice2 = test2.getChildren()[0]
     self.assertEquals(notice2.type, "fail")
     notice2_data = notice2.getRelevantDisplayData()
     self.assertTrue(('file', 'python_unittest_example.py') in notice2_data)
     self.assertTrue(('line', '40') in notice2_data)
     self.assertTrue(('info', "AssertionError: None") in notice2_data)
     
     test3 = tests[3]
     test3_data = test3.getRelevantDisplayData()
     self.assertTrue(('name', 'test_sample') in test3_data)
     notice3 = test3.getChildren()[0]
     self.assertEquals(notice3.type, "ok")
     
     test4 = tests[4]
     test4_data = test4.getRelevantDisplayData()
     self.assertTrue(('name', 'test_shuffle') in test4_data)
     notice4 = test4.getChildren()[0]
     self.assertEquals(notice4.type, "ok")
 def test_ParseStringdata(self):
     '''
     Make sure nothing explodes
     '''
     f = open(computeDataFilepath("./sample/python_unittest_sample", __file__))
     self.parser.parse(stringData = f.read())
 def test_ParseFile(self):
     '''
     Make sure nothing explodes
     '''
     f = open(computeDataFilepath("./sample/python_unittest_sample", __file__))
     self.parser.parse(file = f)