Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8393899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:55:27+00:00 2026-06-09T19:55:27+00:00

I have two test cases (two different files) that I want to run together

  • 0

I have two test cases (two different files) that I want to run together in a Test Suite. I can get the tests to run just by running python “normally” but when I select to run a python-unit test it says 0 tests run. Right now I’m just trying to get at least one test to run correectly.

import usertest
import configtest # first test
import unittest   # second test

testSuite = unittest.TestSuite()
testResult = unittest.TestResult()
confTest = configtest.ConfigTestCase()
testSuite.addTest(configtest.suite())
test = testSuite.run(testResult)
print testResult.testsRun # prints 1 if run "normally"

Here’s an example of my test case set up

class ConfigTestCase(unittest.TestCase):
    def setUp(self):

        ##set up code

    def runTest(self):

        #runs test


def suite():
    """
        Gather all the tests from this module in a test suite.
    """
    test_suite = unittest.TestSuite()
    test_suite.addTest(unittest.makeSuite(ConfigTestCase))
    return test_suite

if __name__ == "__main__":
    #So you can run tests from this module individually.
    unittest.main()

What do I have to do to get this work correctly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T19:55:29+00:00Added an answer on June 9, 2026 at 7:55 pm

    you want to use a testsuit. So you need not call unittest.main().
    Use of testsuit should be like this:

    #import usertest
    #import configtest # first test
    import unittest   # second test
    
    class ConfigTestCase(unittest.TestCase):
        def setUp(self):
            print 'stp'
            ##set up code
    
        def runTest(self):
            #runs test
            print 'stp'
    
    def suite():
        """
            Gather all the tests from this module in a test suite.
        """
        test_suite = unittest.TestSuite()
        test_suite.addTest(unittest.makeSuite(ConfigTestCase))
        return test_suite
    
    mySuit=suite()
    
    runner=unittest.TextTestRunner()
    runner.run(mySuit)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I have two tests that each individually test for a button_click within a
I have two Perl files: action.pl and the other is test.pl action.pl has a
I'm also using Capybara. I have a bunch of test cases.. and two of
I have set up a test that: retrieves data concerning several court cases: each
I have assigned one test case to two different user stories. I know it's
Suppose I have two/many different tests need to be carried out in gtest in
I have tables like these two test_table date student test 2012-05-31 Alice Math 2012-05-31
I have two applications in my project 'test' the applications are one.mxml and two.mxml
I have these two queries to test my output SELECT DISTINCT( providerId ), SUM((
I have two Tables: Table 1: Questions : QuestionId NUMERIC Title TEXT Test Data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.