I am on a website where you login, then search for course, click on course and then it lands on the Credit card page, since its just one course and is common and I am just trying to DDT on CC section and not search section this is what I did.

On the test page this is how my code looks like:

@pytest.mark.usefixtures("oneTimeSetUp","setUp")
@ddt
class SendformTest(.TestCase):
    @pytest.fixture(autouse=True)
    def classSetup(self,oneTimeSetUp):
        self.sf = SendForms(self.driver)
        self.ts = TestStatus(self.driver)


    def setUp(self):  ############ I want this method to run just once after login, this method searches for course and then clicks and land on cc page
        self.sf.navigateToCCForms("img")

    @pytest.mark.run(order = 1)
    @data(*getCSVData("testRegular.csv"))
    @unpack
    def test_cc_Form(self,ccNum, ccExp, ccCVV):
        result = self.sf.verifyOnCCforms() 
        self.ts.mark(result,"On Send Form Page")
        self.sf.ccdetails(ccNum, ccExp, ccCVV)
        result1 = self.sf.sentSuccessMsg()
        self.ts.markFinal("test_sending_Form", result1, "this is test")

Right now this runs once fine and then just sits there, it wont enter data multiple times on the CC page. how do I make setUp method run just once. I tried:

@classmethod
def (self):
    #super(SendformTest, self).()
    self.sf.navigateToSendforms("img")

but getting the:

AttributeError: type object ‘SendformTest’ has no attribute ‘sf’



Source link https://sqa.stackexchange.com/questions/25413/-unittest-trying-to-run-setupclass

LEAVE A REPLY

Please enter your comment!
Please enter your name here