Different class methods are running simultaneous one after the other when i execute test suite

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Different class methods are running simultaneous one after the other when i execute test suite

manu0613mj
I have written a test suite to execute all my test cases one after the other .
But the problem is that while executing , its simultaneously taking the methods from both class one after the other and executing.(i mean instead of executing all the methods from one class and then proceed to next class it is combining both the class methods and executing at once)
This is the code i have written

Test suite
  1. import unittest
  2. from tests.Home.hamburger_test import hamburgerTest
  3. from tests.Home.topic_test import TopicTest
  4.  
  5. # Get all tests from the test classes
  6. tc1 = unittest.TestLoader().loadTestsFromTestCase(hamburgerTest)
  7. tc2 = unittest.TestLoader().loadTestsFromTestCase(TopicTest)
  8.  
  9. # Create a test suite combining all test classes
  10.  
  11. Test1 = unittest.TestSuite([tc1, tc2])
  12.  
  13.  
  14. unittest.TextTestRunner(verbosity=2).run(Test1)


First test class:

  1. from pages.Home.hamburger_page import HamburgerPage
  2. from utilites.testStatus import TestStatus
  3. import pytest
  4. import unittest
  5.  
  6.  
  7. @pytest.mark.usefixtures("oneTimeSetUp", "setUp")
  8. class hamburgerTest(unittest.TestCase):
  9.  
  10. @pytest.fixture(autouse=True)
  11. def classSetup(self, oneTimeSetUp):
  12. self.ha = HamburgerPage(self.driver)
  13. self.ts = TestStatus(self.driver)
  14.  
  15. @pytest.mark.run(order=1)
  16. def test_hamburger_menu_latest_WAF021(self):
  17. result = self.ha.find_latest()
  18. self.ts.markFinal("To find latest link", result, "Click on latest link")
  19.  
  20. @pytest.mark.run(order=2)
  21. def test_hamburger_menu_top__WAF022(self):
  22. result = self.ha.find_topics_links()
  23. self.ts.markFinal("To find top link", result, "Click on top link")
  24.  
  25. @pytest.mark.run(order=3)
  26. def test_hamburger_menu_badges__WAF023(self):
  27. result = self.ha.find_badges()
  28. self.ts.markFinal("To find badges link", result, "Click on badges link")
  29.  
  30. @pytest.mark.run(order=4)
  31. def test_hamburger_menu_users__WAF024(self):
  32. result = self.ha.find_users()
  33. self.ts.markFinal("To find user link ", result,"Click on users link")

Second Test Class:

  1. from pages.Home.topic_page import topicPage
  2. from utilites.testStatus import TestStatus
  3. import pytest
  4. import unittest
  5. import time
  6.  
  7. @pytest.mark.usefixtures("oneTimeSetUp","setUp")
  8. class TopicTest(unittest.TestCase):
  9. @pytest.fixture(autouse=True)
  10. def classSetup(self,oneTimeSetUp):
  11. self.tp = topicPage(self.driver)
  12. self.ts = TestStatus(self.driver)
  13.  
  14. @pytest.mark.run(order=1)
  15. def test_header_login(self):
  16. self.tp.find_header_logIn()
  17.  
  18. @pytest.mark.run(order=2)
  19. def test_validLogin(self):
  20. self.tp.getelements("[hidden email]", "xxxxx")
  21. time.sleep(3)
  22.  
  23. @pytest.mark.run(order=3)
  24. def test_FirstLinkInAnnouncements(self):
  25. self.tp.find_first_announcement_link()
  26. time.sleep(3)

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3e17fdf5-5612-4210-98c8-aa8a43acd2d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.