I'm working on automated testing in pytest, and i'm looking for a way to read params from a config file that are specific to a test and add it to the appropriate test.
for example I would like my config.ini file to look like this:
[Driver]
#some genral variables
[Test_exmpl1]
#variables that I would like to use in Test_exmpl1
username= exmp@gmail.com
password= 123456
[Test_exmpl2]
#variables that I would like to use in Test_exmpl2
username= exmp2@gmail.com
password= 123456789
Now in the code I would like to be able to use these params in the correct test:
class Test_exmpl1(AppiumTestCase):
def test_on_board(self):
self.view = Base_LoginPageObject()
# view = BaseLoginPageObject
self.view = self.view.login(config.username, config.password)
#config.username =exmp@gmail.com
#config.password = 123456
class Test_exmpl2(AppiumTestCase):
def test_on_board(self):
self.view = Base_LoginPageObject()
# view = BaseLoginPageObject
self.view = self.view.login(config.username, config.password)
#config.username =exmp2@gmail.com
#config.password = 123456789
Does anyone have an idea how I should go about doing that?