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:

class SendformTest(.TestCase):
    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

    @pytest.mark.run(order = 1)
    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:

def (self):
    #super(SendformTest, self).()

but getting the:

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

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


Please enter your comment!
Please enter your name here