diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..b1d80f2 --- /dev/null +++ b/404.html @@ -0,0 +1,590 @@ + + + +
+ + + + + + + + + + + + + + +In Combidata, a Case
represents a specific test scenario or variation. It is defined using a dictionary structure with specific keys that have predefined meanings. This guide will help you understand how to define a Case
and what each key represents.
A Case
is defined as a dictionary. Each key-value pair in the dictionary corresponds to a specific attribute or property of the case. Here's a breakdown of the keys you can use:
value
or options
if they are provided.gen_func
is provided, this will be the first argument for that function. This can be of any data type.gen_func
. The key in this dictionary will be the argument name for the function, and the associated value will be the argument value.Any key in the Case
dictionary that is not one of the reserved keys mentioned above is considered an "Additional Field". These fields are user-defined and can be used to store any extra information or metadata related to the case.
For example, in the provided sample, the key "error" with its associated dictionary ({"code": 400, "message": "Sample Error Message"}
) is an additional field. It provides extra information about the error scenario being tested.
You can access the values of additional fields just like you would access any key-value pair in a dictionary:
+case_value = my_case["additional_field_name"]
+
Here's a sample Case
definition for better understanding:
relatives["cases"]["FIELD_NAME"] = {
+ "MODE_CODE": {
+ "value": "Sample Value",
+ "name": "Descriptive Name for the Case",
+ "requirements": {"ANOTHER_FIELD": ["MODE_CODE_1", "MODE_CODE_2"]},
+ "type": "error",
+ "error": {"code": 400, "message": "Sample Error Message"}
+ },
+ ...
+}
+
In this example:
+"FIELD_NAME" is the name of the field being tested.
+"MODE_CODE" is a unique code representing a specific test scenario or variation for "FIELD_NAME".
+The dictionary associated with "MODE_CODE" defines the properties of that specific test scenario.
+Defining a Case
in Combidata involves setting up a dictionary with specific keys that have predefined meanings. The flexibility of the structure allows you to define a wide range of test scenarios and variations, making it a powerful tool for comprehensive testing.
The Combination
class represents a combination of test data and associated processes. It plays a crucial role in the test generation process and is utilized within various process classes. It provides a structured way to manage and manipulate test data during the execution of test processes.
Integration with Process Classes: The Combination
class is passed as an argument to process classes, making it an essential component for test generation and execution.
Cache Usage: Within the processes, the cache
attribute of the Combination
class can be utilized. This dictionary attribute allows for the addition, modification, and retrieval of key-value pairs, facilitating dynamic data storage and manipulation during test execution.
Emergency Stop: In unforeseen situations where a process needs to be halted immediately, the step_done
attribute can be set to "STOP" (in uppercase). This signals an immediate termination of the current process.
Access in Generation Function: The Combination
class can be accessed within the Generation function. By using the Options
key and setting its value to the reserved word "combination", the class instance can be retrieved and manipulated.
When defining a process, ensure that the Combination
class is passed as an argument. This allows for seamless integration and data flow between the test generation logic and the processes. The cache
attribute can be used for temporary data storage, and in case of any unexpected issues, the process can be stopped by setting step_done
to "STOP".
test_seed: A dictionary that is formed during the ST CombineProcess. It's optional and might not be used if the ST CombineProcess is not invoked.
+formed_data: A dictionary that is formed during the ST FormProcess. It's optional and might not be used if the ST FormProcess is not invoked.
+step_done: A string indicating the last successful step.
+init_lib: A dictionary that is a copy of the initial library.
+main_case: An instance of the main case.
+template: A dictionary that holds the export template.
+tools: A dictionary containing intangible user tools.
+generated_data: A dictionary holding all data generated during the ST Generate step.
+other_cases: A dictionary storing other cases that take part in the test.
+cache: A dictionary that serves as a store for your steps and processes. It can be used to store any data that might be needed during the execution of processes.
+workflow: Either a list or tuple containing processes.
+This documentation provides a comprehensive overview of the Combination
class, its attributes, and how it can be used within process functions.
The DataGenerator
class serves as a pivotal component in the test generation framework. Its primary function is to produce test data based on a provided library of test cases and specific configurations. By doing so, it ensures that the generated tests adhere to the given criteria, such as possible fields, modes, and types of cases.
The DataGenerator
class can be initialized in various ways, depending on the requirements and the level of specificity needed.
The simplest way to initialize the DataGenerator
class is by providing just the test library:
generator = DataGenerator(library=your_test_library)
+
For a more detailed configuration, you can provide additional parameters:
+generator = DataGenerator(
+ library=your_test_library,
+ banned_fields=["field1", "field2"],
+ possible_fields=["field3", "field4"],
+ possible_modes={"mode1": "value1", "mode2": "value2"},
+ type_of_cases=["type1", "type2"],
+ types_for_generation=["type3", "type4"],
+ amount=10
+)
+
In cases where you only want to specify the types of cases and types for generation as strings:
+generator = DataGenerator(
+ library=your_test_library,
+ type_of_cases="type1",
+ types_for_generation="type3"
+)
+
To execute the test generation process, use the run
method:
generator.run()
+
If you wish to obtain a specific test case, you can use the appropriate method:
+# This method needs to be verified in the code for its exact name and usage
+single_test_case = generator.get_single_test_case(case_name="desired_case_name")
+
Post generation, you can access the combinations created:
+combinations = generator.combinations
+for combination_name, combination_instance in combinations.items():
+ # Process each combination as needed
+
Upon completion of the test generation process, the results can be accessed and processed as required. The combinations
attribute of the DataGenerator
class holds the generated test data, with each combination being an instance of the Combination
class. This allows for further manipulation, analysis, or export of the test data as needed.
Note: Always refer to the actual code implementation for any updates or changes to the methods and their usages.
+ + + + + + + + + + + + + +This package is tested with Python 3.9-3.11 and Pypy 3. +There are two ways to install the library:
+pip install combidata
+
git clone https://github.com/Warrfie/combidata
+cd combidata
+python setup.py install
+
pip install git+https://github.com/Warrfie/combidata
+
It is generally recommended to use the first option.
+Package is still under development, and it has regular updates, do not forget to update it regularly by calling +
pip install combidata --upgrade
+
The Process
class represents a test step or process within the Combidata framework. It is designed to execute a specific function (referred to as given_func
) as part of the test step. This function will continue to run until it returns True
, indicating the completion of the process.
func (function):
+True
to indicate the completion of the process. It must also accept an argument of type Combination
.def sample_func(combination):
+ # Your logic here
+ return True
+
name (str):
+name
must be unique across all instances to avoid conflicts.process_name = "sample_process"
+
To define a test step, instantiate the Process
class by providing the necessary attributes:
from combidata import Process
+
+def sample_func(combination):
+ # Your logic here
+ return True
+
+process_instance = Process(name="sample_process", given_func=sample_func)
+
name
attribute is unique to avoid any potential conflicts during execution.given_func
is essential and must always return a boolean value (True
or False
). It should return True
to indicate the successful completion of the process.given_func
must accept an argument of type Combination
. This allows you to access and manipulate the combination data within the function.Welcome to Combidata, a case-oriented library designed for compositional testing of combinatorics in IT product functionalities. This guide will walk you through the basic structure and usage of Combidata to help you get started quickly.
+Combidata allows you to define test cases and workflows, and then generate test data based on these definitions. It provides a flexible and powerful way to handle combinatorial testing, ensuring that all possible combinations of inputs are tested.
+The main structure of the input library is as follows:
+library = {
+ "cases": {},
+ "workflow": (ST_COMBINE, ST_GENERATE, ST_FORM),
+ "tools": {},
+ "template": {}
+}
+
Cases are the heart of Combidata. They define the different test scenarios you want to cover. Each case is associated with a field, and each field can have multiple cases. Here's a brief overview of the case structure:
+library["cases"]["FIELD_NAME"] = {
+ "CASE_CODE": {
+ "name": "Description of the case",
+ "gen_func": function_for_generation,
+ "value": "Value or pattern for the case",
+ "options": {"key": "value"},
+ "is_presented": True/False,
+ "requirements": {"AnotherField": "CaseCode"},
+ "type": "Type of the case"
+ }
+}
+
The workflow defines the sequence of processes that Combidata will execute during test generation. You can define a single workflow or multiple workflows based on your testing needs.
+"workflow": (ST_COMBINE, ST_GENERATE, ST_FORM)
+
Each process in the workflow is an instance of the Process
class, which takes a name and a function. The function should return True
when it's done, or you can stop the workflow prematurely using combination.step_done = "STOP"
.
The tools section is a warehouse for utilities, functions, or any other resources you might need during test generation. You can access these tools within your processes using combination.tools["TOOL_NAME"]
.
The template defines the format of the exported test results. It's a simple dictionary where each key is a field name, and the value is the case code. Combidata will replace these placeholders with the generated test data.
+Once you've defined your library, you can create an instance of the DataGenerator
class and call its run()
method to generate test data. Here's a simple example:
generator = DataGenerator(library)
+generator.run()
+
You can then use the generated combinations in your tests. For instance, using pytest:
+@pytest.mark.parametrize("combination_name", generator.combinations.keys())
+def test(combination_name):
+ combination = generator.combinations[combination_name]
+ combination.run()
+ # Your test assertions here
+
Combidata provides a powerful and flexible way to handle combinatorial testing in IT products. By defining cases, workflows, and templates, you can ensure comprehensive test coverage for your product's functionalities. Whether you're new to compositional testing or an experienced tester, Combidata offers the tools and flexibility you need to achieve your testing goals.
+ + + + + + + + + + + + + + + + + + +{"use strict";/*!
+ * escape-html
+ * Copyright(c) 2012-2013 TJ Holowaychuk
+ * Copyright(c) 2015 Andreas Lubbe
+ * Copyright(c) 2015 Tiancheng "Timothy" Gu
+ * MIT Licensed
+ */var Wa=/["'&<>]/;Vn.exports=Ua;function Ua(e){var t=""+e,r=Wa.exec(t);if(!r)return t;var o,n="",i=0,s=0;for(i=r.index;i