Ejemplo n.º 1
0
 def test_parse_parameters_custom_function(self):
     parameters = [{
         "app_version": "${gen_app_version()}"
     }, {
         "username-password": "******"
     }]
     testset_path = os.path.join(os.getcwd(),
                                 "tests/data/demo_parameters.yml")
     cartesian_product_parameters = context.parse_parameters(
         parameters, testset_path)
     self.assertEqual(len(cartesian_product_parameters), 2 * 2)
Ejemplo n.º 2
0
 def test_parse_parameters_parameterize(self):
     parameters = [{
         "app_version": "${parameterize(app_version.csv)}"
     }, {
         "username-password": "******"
     }]
     testset_path = os.path.join(os.getcwd(),
                                 "tests/data/demo_parameters.yml")
     cartesian_product_parameters = context.parse_parameters(
         parameters, testset_path)
     self.assertEqual(len(cartesian_product_parameters), 2 * 3)
Ejemplo n.º 3
0
 def test_parse_parameters_mix(self):
     parameters = [{
         "user_agent": ["iOS/10.1", "iOS/10.2", "iOS/10.3"]
     }, {
         "app_version": "${gen_app_version()}"
     }, {
         "username-password": "******"
     }]
     testset_path = os.path.join(os.getcwd(),
                                 "tests/data/demo_parameters.yml")
     cartesian_product_parameters = context.parse_parameters(
         parameters, testset_path)
     self.assertEqual(len(cartesian_product_parameters), 3 * 2 * 3)
Ejemplo n.º 4
0
 def test_parse_parameters_raw_list(self):
     parameters = [{
         "user_agent": ["iOS/10.1", "iOS/10.2", "iOS/10.3"]
     }, {
         "username-password": [("user1", "111111"), ["test2", "222222"]]
     }]
     cartesian_product_parameters = context.parse_parameters(parameters)
     self.assertEqual(len(cartesian_product_parameters), 3 * 2)
     self.assertEqual(cartesian_product_parameters[0], {
         'user_agent': 'iOS/10.1',
         'username': '******',
         'password': '******'
     })
Ejemplo n.º 5
0
    def _get_parametered_variables(self, variables, parameters):
        """ parameterize varaibles with parameters
        """
        cartesian_product_parameters = context.parse_parameters(
            parameters, self.testset_file_path) or [{}]

        parametered_variables_list = []
        for parameter_mapping in cartesian_product_parameters:
            parameter_mapping = parameter_mapping or {}
            variables = utils.override_variables_binds(variables,
                                                       parameter_mapping)

            parametered_variables_list.append(variables)

        return parametered_variables_list