Difference between revisions of "Processing test"

From Open Food Facts wiki
Jump to navigation Jump to search
(added categories)
 
(27 intermediate revisions by the same user not shown)
Line 1: Line 1:
[  
+
<small>[[Processing Taxonomy|< Processing Taxonomy]]</small>
{ lc => "en", ingredients_text => "raw milk, sliced tomatoes, garlic powder, powdered eggplant, courgette powder"},  
+
 
[
+
All tests follow the same structure. There is one ''test set'' per ''test  language''. Each ''test'' set consists of multiple ''tests''.  Each ''test'' check the correct parsing and interpretation of a processed ingredient. A ''processed ingredient'' consists of a ''process'', taken from the ''ingredients processing taxonomy'' and an ''ingredient'' form the ''ingredients taxonomy''.
  {
+
 
    'id' => 'en:raw-milk',
+
== Template ==
    'text' => 'raw milk'
+
The template for an ingredient and process test is described here:
   },
+
 
  {
+
  [ {  
     'id' => 'en:tomato',
+
Define the language ('''lc''') for which the tests are applicable, for example dutch (''nl'').
    'processing' => 'en:sliced',
+
  lc => "nl",
     'text' => 'tomatoes'
+
Define in the '''ingredients_text''' the process- ingredient combination that must be tested. In the example we want to test the processed ingredients ''sjalotpoeder'', ''wei-poeder'', vanillepoeder and ''gepelde sjalot''. In this example are ''poeder'' and ''gepelde'' the processes; and ''sjalot'', ''wei'' and ''vanille'' the ingredients. It is important that these processed ingredients are NOT in the ingredients taxonomy. The ingredients taxonomy has precedence over the process taxonomy.
  },
+
  ingredients_text => "sjalotpoeder, wei-poeder, vanillepoeder, gepelde sjalot" },
  {
+
 
     'id' => 'en:garlic-powder',
+
The ingredients_text ''sjalotpoeder'', should result in the ingredient with id ''en:shallot'' and process ''en:powdered''. These are the key entries in the ingredients and process taxonomy respectively. Usually these are in english (en:).
    'text' => 'garlic powder'
+
   [ {
 +
     'id' => 'en:shallot',
 +
     'text' => 'sjalot',
 +
     'processing' => 'en:powdered'
 
   },
 
   },
 +
 +
The ingredients_text ''sliced tomatoes'', should result in the ingredient with id ''en:tomato'' and processing ''en:sliced''.
 +
    {
 +
      'id' => 'en:tomato',
 +
The '''id''' represents the parent key of ''sliced tomatoes'' in the ingredients taxonomy.
 +
      'processing' => 'en:sliced',
 +
The '''processing''' is the key of ''sliced'' in the processing taxonomy.
 +
      'text' => 'tomatoes'
 +
The '''text''' is parent key of the entry ''sliced tomatoes'' in the ingredients taxonomy ????
 +
    },
 +
 +
    {
 +
      'id' => 'en:garlic-powder',
 +
      'text' => 'garlic powder'
 +
    },
 +
 
   {
 
   {
 
     'id' => 'en:aubergine',
 
     'id' => 'en:aubergine',
Line 20: Line 39:
 
     'text' => 'eggplant'
 
     'text' => 'eggplant'
 
   },
 
   },
 +
 
   {
 
   {
'id' => 'en:courgette',
+
    'id' => 'en:courgette',
 
     'processing' => 'en:powdered',
 
     'processing' => 'en:powdered',
 
     'text' => 'courgette'
 
     'text' => 'courgette'
   }
+
  }
] ]
+
  ] ]
 +
 
 +
== Error message ==
 +
  #   Failed test at t/ingredients_processing.t line 143.
 +
17060
 +
#    Structures begin differing at:
 +
17061
 +
#          $got->[3]{text} = 'gehakte tomaten'
 +
17062
 +
#    $expected->[3]{text} = 'tomaten'
 +
17063
 +
[[Category:Processing Taxonomy]]
 +
[[Category:Testing]]

Latest revision as of 08:25, 5 October 2022

< Processing Taxonomy

All tests follow the same structure. There is one test set per test language. Each test set consists of multiple tests. Each test check the correct parsing and interpretation of a processed ingredient. A processed ingredient consists of a process, taken from the ingredients processing taxonomy and an ingredient form the ingredients taxonomy.

Template

The template for an ingredient and process test is described here:

  [ { 

Define the language (lc) for which the tests are applicable, for example dutch (nl).

  lc => "nl",

Define in the ingredients_text the process- ingredient combination that must be tested. In the example we want to test the processed ingredients sjalotpoeder, wei-poeder, vanillepoeder and gepelde sjalot. In this example are poeder and gepelde the processes; and sjalot, wei and vanille the ingredients. It is important that these processed ingredients are NOT in the ingredients taxonomy. The ingredients taxonomy has precedence over the process taxonomy.

  ingredients_text => "sjalotpoeder, wei-poeder, vanillepoeder, gepelde sjalot" },

The ingredients_text sjalotpoeder, should result in the ingredient with id en:shallot and process en:powdered. These are the key entries in the ingredients and process taxonomy respectively. Usually these are in english (en:).

 [ {
   'id' => 'en:shallot',
   'text' => 'sjalot',
   'processing' => 'en:powdered'
 },

The ingredients_text sliced tomatoes, should result in the ingredient with id en:tomato and processing en:sliced.

    {
      'id' => 'en:tomato',

The id represents the parent key of sliced tomatoes in the ingredients taxonomy.

      'processing' => 'en:sliced',

The processing is the key of sliced in the processing taxonomy.

      'text' => 'tomatoes'

The text is parent key of the entry sliced tomatoes in the ingredients taxonomy ????

    },
    {
      'id' => 'en:garlic-powder',
      'text' => 'garlic powder'
    },
 {
   'id' => 'en:aubergine',
   'processing' => 'en:powdered',
   'text' => 'eggplant'
 },
 {
   'id' => 'en:courgette',
   'processing' => 'en:powdered',
   'text' => 'courgette'
  }
  ] ]

Error message

  #   Failed test at t/ingredients_processing.t line 143.

17060

  1. Structures begin differing at:

17061

  1. $got->[3]{text} = 'gehakte tomaten'

17062

  1. $expected->[3]{text} = 'tomaten'

17063