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

  • SEARCH
  • Home
  • 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 6225239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:48:25+00:00 2026-05-24T08:48:25+00:00

I need to make a big python suitecase consisted of other suitcases and testcase

  • 0

I need to make a big python suitecase consisted of other suitcases and testcase which I have already made to execute together.

How do I do this?

For example, here there is a suitecase (suiteFilter.py) which I want to add:

import testFilter1
import testFilter2
import unittest
import sys

def suite():
    return unittest.TestSuite((\
        unittest.makeSuite(testFilter1.TestFilter1),
        unittest.makeSuite(testFilter2.TestFilter2),
        ))


if __name__ == "__main__":
    result = unittest.TextTestRunner(verbosity=2).run(suite())
    sys.exit(not result.wasSuccessful())

And a testcase structure (Invoice.py):

from selenium import selenium
import unittest, time, re
from setup_tests import filename, fileForNrTest, username, password, server_url
fileW=open(filename,'a')


class TestInvoice(unittest.TestCase):

    def setUp(self):
        self.verificationErrors = []
        self.selenium = selenium("localhost", 4444, "*firefox", server_url)
        self.selenium.start()

    def test_invoice(self):
        sel = self.selenium
        [...] 

    def tearDown(self):
        self.selenium.stop()
        self.assertEqual([], self.verificationErrors)


    if __name__ == "__main__":
        unittest.main()

Thank you!

  • 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-05-24T08:48:26+00:00Added an answer on May 24, 2026 at 8:48 am

    You could give some additional information like the structure of your program / test cases and suites. The way I do it is define a suite() for each module. So I have say for UserServiceTest module:

    def suite():
        """
            Gather all the tests from this module in a test suite.
        """
        test_suite = unittest.TestSuite()
        test_suite.addTest(unittest.makeSuite(UserServiceTest))
        return test_suite
    
    if __name__ == "__main__":
        #So you can run tests from this module individually.
        unittest.main()   
    

    Then I have a main test for each package:

    def suite():
    """
        Gather all the tests from this package in a test suite.
    """
        test_suite = unittest.TestSuite()
        test_suite.addTest(file_tests_main.suite())
        test_suite.addTest(userservice_test.suite())
        return test_suite
    
    
    if __name__ == "__main__":
        #So you can run tests from this package individually.
        TEST_RUNNER = unittest.TextTestRunner()
        TEST_SUITE = suite()
        TEST_RUNNER.run(TEST_SUITE)
    

    You can do this the recursevly until the root of your project. So main test from package A will gather all module in package A + main test from subpackages of package A and so on. I was assuming you-re using unittest since you didn’t give any additional details but I think this structure can be applied to other python testing frameworks as well.


    Edit: Well I’m not quite sure I fully understand your problem, but from what I can understand you want to add both the suite defined in suiteFilter.py and the testcase defined in Invoice.py in the same suite? If so why not just do in a mainTest.py for example:

    import unittest
    import suiteFilter
    import Invoice
    
    
    def suite()
        test_suite = unittest.TestSuite()
        test_suite.addTest(suiteFilter.suite())
        test_suite.addTest(unittest.makeSuite(Invoice))
    
    
    if __name__ == "__main__":
        result = unittest.TextTestRunner(verbosity=2).run(suite())
        sys.exit(not result.wasSuccessful())
    

    You can add tests and suites all the same to a test_suite.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im programming C# WinForm application which have big SQL Server Database. I need to
I have a crystal report file I need make a tiny edit in. It
I need to make an ArrayList of ArrayLists thread safe. I also cannot have
I need to make a graphic interface in Lazarus from which I run miscelaneous
Well i need to make it so any user can have a foo.com/username in
I have a big problem and no idea how to solve it. I need
I have a image field in the model. I need to make two copies(resized)
I need to make big string into a nice array. String itself is list
I need to make some big multiplications for cryptographic reasons in vb.net and overflow
I need to make a WebCast presentation soon and need to do some whiteboarding

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.