jeudi 15 novembre 2018

Django testing combinatory

i´m making some database testing case. We need to make a all test case which only change the insert data.

    class Tests_All(TransactionTestCase):
    reset_sequences = True

        def test_car_pk(self):
            car = Car.objects.create(company="car_company", type="electrical",type_owner="regular")
            self.assertEqual(car.pk, 1)

So, i have a company choose, type choose and type_owner choose For example, we have 12 Companys, 5 Type, 2 type_owner. A full test should be 12x5x2 = 120 Test. This type of test maybe is not a good practice. But the main question is, there is method in django to make the test ? I read the documentation and didn´t get a example. Is like a general test make with all the case by changing the value of the parameter (compnay,type,type_owner)

Aucun commentaire:

Enregistrer un commentaire