### Creating an Object with a Specific GUID Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/object-builder.md Demonstrates how to create a new 'Counterparty' object, automatically fill its mandatory fields, set a specific GUID, and then save it. ```APIDOC ## Creating an Object with a Specific GUID ### Description This example shows how to create a new object of type 'Справочник.Контрагенты', automatically populate its mandatory fields, assign a specific GUID, and then save the object. ### Method `ЮТест.Данные().КонструкторОбъекта("Справочник.Контрагенты").ФикцияОбязательныхПолей().УстановитьСсылкуНового("00000000-0000-0000-0000-000000000001").Установить("Наименование", "Контрагент с заданным GUID").Записать();` ### Parameters - `ФикцияОбязательныхПолей()`: Automatically fills mandatory fields. - `УстановитьСсылкуНового("00000000-0000-0000-0000-000000000001")`: Sets the GUID for the new object. - `Установить("Наименование", "Контрагент с заданным GUID")`: Sets the 'Наименование' (Name) property. ### Action `.Записать()`: Saves the created object. ``` -------------------------------- ### Example of Predicate Usage for Complex Filtering Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md Demonstrates how to use predicates to define complex search conditions, such as finding a counterparty whose name starts with 'Test' and has an empty INN. ```bsl // Найти случайного контрагента, у которого наименование начинается с "Тест" // и ИНН не заполнен. Предикат = ЮТест.Предикат() .Реквизит("Наименование").Подобно("Тест%") .Реквизит("ИНН").Равно(""); СлучайныйКонтрагент = ЮТест.Данные().СлучайнаяСсылка("Справочник.Контрагенты", Предикат); ``` -------------------------------- ### Searching for an Organization by Name Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md This example demonstrates how to find an organization by its name. ```APIDOC ## Searching for an Organization by Name ### Description Finds an organization by its name. ### Method `ЮТест.Данные().Ссылка("Справочник.Организации", ИмяОрганизации)` ### Parameters - **МетаданныеОбъекта** (string) - Required - "Справочник.Организации" - **ИмяОбъекта** (string) - Required - The name of the organization to search for. ### Response - **Success Response (200)**: Returns a link to the organization if found, otherwise Undefined. - **Example**: `СсылкаНаОрганизацию` ``` -------------------------------- ### Original Platform Method Call Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/cook-book/platform-mocking.md This is an example of a platform method call that cannot be directly mocked. ```bsl Период = ТекущаяДатаСеанса(); ``` -------------------------------- ### Mockito Training Example: Skip and Return Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/mockito/mockito.md Example of Mockito training where one method is skipped and another is set to return a specific value. It also demonstrates observing a method without altering its behavior. ```bsl Мокито.Обучение(ОтправкаСМС_Провайдер1) .Когда("УстановитьСоединение").Пропустить() .Когда("ПослатьСообщение").Вернуть(Ответ) .Наблюдать("ОбработатьОтвет") ``` -------------------------------- ### Searching for a Counterparty by INN Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md This example demonstrates how to find a counterparty by its INN (Taxpayer Identification Number). ```APIDOC ## Searching for a Counterparty by INN ### Description Finds a counterparty by its INN. ### Method `ЮТест.Данные().СсылкаПоРеквизиту("Справочник.Контрагенты", "ИНН", ИНН)` ### Parameters - **МетаданныеОбъекта** (string) - Required - "Справочник.Контрагенты" - **ИмяРеквизита** (string) - Required - "ИНН" - **ЗначениеРеквизита** (string) - Required - The INN value to search for. ### Response - **Success Response (200)**: Returns a link to the counterparty if found, otherwise Undefined. - **Example**: `СсылкаНаКонтрагента` ``` -------------------------------- ### Searching for a User by Code with Additional Filtering Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md This example shows how to find a user by their code and apply additional filters. ```APIDOC ## Searching for a User by Code with Additional Filtering ### Description Finds a user by their code and applies additional filters, such as validity. ### Method `ЮТест.Данные().Ссылка(Справочники.Пользователи, КодПользователя, Отбор)` ### Parameters - **МетаданныеОбъекта** (Manager) - Required - `Справочники.Пользователи` - **КодОбъекта** (string) - Required - The code of the user to search for. - **Отбор** (Structure) - Optional - A structure containing additional filter criteria, e.g., `New Structure("Недействителен", Ложь)`. ### Response - **Success Response (200)**: Returns a link to the user if found, otherwise Undefined. - **Example**: `СсылкаНаПользователя` ``` -------------------------------- ### Mocking Database Data in 1C Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/mocking.md Create mock data for database interactions to test data processing logic. This example prepares a collection of 'Реализация' documents for processing. ```bsl Реализация1 = ДанныеТестовойРеализации(Контрагент1, 1000); // Вернет структуру с набором реквизитов реализации Реализация2 = ДанныеТестовойРеализации(Контрагент2, 2000); // Вернет структуру с набором реквизитов реализации Обработка.ОбработатьРеализации(ЮТКоллекции.ЗначениеВМассиве(Реализация1, Реализация2)); ``` -------------------------------- ### Mocking with Method and Parameters, then Running Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/mockito/how-to.md This snippet demonstrates setting up a mock for a method with specific parameters and then activating the mock using `Run()`. It also includes a test assertion to verify the mocked behavior. ```bsl // Finish mock setup and switch Mockito to run mode Mockito.Learn(WorkWithHTTP) .When("SendObjectToServer", Mockito.ArrayParameters(DataSource, Data)) .Return(2) .Run(); // Activate mock settings // Perform a test call to the method and check the result YTest.AssertThat(WorkWithHTTP.SendObjectToServer(DataSource, Data)) .IsEqualTo(2); ``` -------------------------------- ### Create and Post Document - Incoming Order Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/object-builder.md This snippet demonstrates creating and posting a document. It includes setting a reference field, adding a row to a tabular section with specific values, and then posting the document. The posted document object is returned. ```bsl ПриходныйОрдер = ЮТест.Данные().КонструкторОбъекта("Документ.ПриходныйОрдер") .ФикцияОбязательныхПолей() // Автоматически заполняем обязательные поля .Установить("Контрагент", Справочники.Контрагенты.НайтиПоКоду("00001")) .ТабличнаяЧасть("Товары") .ДобавитьСтроку() .Установить("Номенклатура", Справочники.Номенклатура.НайтиПоКоду("00001")) .Установить("Количество", 10) .Провести(Истина); // Проводим документ и возвращаем объект Сообщить("Проведен документ: " + ПриходныйОрдер.Номер); ``` -------------------------------- ### Create Counterparty with Specific GUID Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/object-builder.md This snippet demonstrates how to create a 'Counterparty' object with a predefined GUID and a specific name using the Object Builder. It automatically fills mandatory fields and then sets the GUID and name before saving. ```bsl Контрагент = ЮТест.Данные().КонструкторОбъекта("Справочник.Контрагенты") .ФикцияОбязательныхПолей() // Автоматически заполняем обязательные поля .УстановитьСсылкуНового("00000000-0000-0000-0000-000000000001") // Устанавливаем GUID .Установить("Наименование", "Контрагент с заданным GUID") .Записать(); Сообщить("Создан контрагент с GUID: " + Контрагент.Наименование); ``` -------------------------------- ### Using ADO.RecordSet Stub for Testing Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/stubs/ado-recordset.md This example demonstrates how to create and populate an ADO.RecordSet stub, then use it to test data retrieval and record counting. It shows the fluent API for adding data and basic navigation and field access. ```bsl Процедура ТестADORecordSet() // Создаем заглушку ADO.RecordSet с двумя колонками: "ID" и "Name" Заглушка = ЮТест.Данные().ADORecordSet("ID", "Name"); // Добавляем данные в заглушку Заглушка.Добавить(1, "Item 1") .Добавить(2, "Item 2") .Добавить(3, "Item 3"); // Перемещаемся на первую запись Заглушка.MoveFirst(); // Проверяем значения полей ЮТест.ОжидаетЧто(Заглушка.Fields("ID")).Равно(1); ЮТест.ОжидаетЧто(Заглушка.Fields("Name")).Равно("Item 1"); // Перемещаемся на следующую запись Заглушка.MoveNext(); // Проверяем значения полей ЮТест.ОжидаетЧто(Заглушка.Fields("ID")).Равно(2); ЮТест.ОжидаетЧто(Заглушка.Fields("Name")).Равно("Item 2"); // Проверяем количество записей ЮТест.ОжидаетЧто(Заглушка.RecordCount).Равно(3); КонецПроцедуры ``` -------------------------------- ### Test Data Lifetime Examples Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/test-data-deletion.md This example demonstrates how data created at different stages of testing (before all tests, before a test set, within a test) has different lifetimes managed by the deletion mechanism. ```bsl Процедура ПередВсемиТестами() Экспорт ДанныеМодуля = ЮТест.Данные().СоздатьЭлемент(); КонецПроцедуры Процедура ПередТестовымНабором() Экспорт ДанныеНабора = ЮТест.Данные().СоздатьЭлемент(); КонецПроцедуры Процедура ПослеВсехТестов() Экспорт ДанныеТеста = ЮТест.Данные().СоздатьЭлемент(); КонецПроцедуры Процедура Тест() Экспорт Ссылка = ЮТест.Данные().СоздатьЭлемент(); КонецПроцедуры ``` -------------------------------- ### Create Incoming Document Constructor with Presets Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/getting-started/auxiliary-modules.md Provides a constructor for incoming documents with basic fields, allowing for further customization. This is useful when direct object creation is complex or when a set of preset methods for different cases is needed. ```bsl Функция КонструкторПоступленияТовара(Склад, Поставщик = Неопределено) Экспорт Конструктор = ЮТест.Данные().КонструкторОбъекта(Документы.ПоступлениеТоваров) .ФикцияОбязательныхПолей() .Установить("Склад"); Если Поставщик = Неопределено Тогда Конструктор.Фикция("Поставщик"); Иначе Конструктор.Установить("Поставщик", Поставщик); КонецЕсли Возврат Конструктор; КонецФункции Функция НовоеПоступлениеТовара(Склад, Товар, Поставщик = Неопределено) Экспорт Конструктор = КонструкторПоступленияТовара(Склад, Поставщик); Возврат Конструктор .ТабличнаяЧасть("Товары") .ДобавитьСтроку() .Установить("Номенклатура", Товар) .ФикцияРеквизитов("Количество, Цена") .Записать(); КонецФункции Функция НовоеПоступлениеТовараОтЮрЛица(Склад, Товар) Экспорт Поставщик = НовоеЮрЛицо(); Конструктор = КонструкторПоступленияТовара(Склад, Поставщик); Возврат Конструктор .ТабличнаяЧасть("Товары") .ДобавитьСтроку() .Установить("Номенклатура", Товар) .ФикцияРеквизитов("Количество, Цена") .Записать(); КонецФункции Функция НовоеПоступлениеТовараОтФизЛица(Склад, Товар) Экспорт Поставщик = НовоеФизЛицо(); Конструктор = КонструкторПоступленияТовара(Склад, Поставщик); Возврат Конструктор .ТабличнаяЧасть("Товары") .ДобавитьСтроку() .Установить("Номенклатура", Товар) .ФикцияРеквизитов("Количество, Цена") .Записать(); КонецФункции ``` -------------------------------- ### Create Document with Random Values (Traditional) Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/getting-started/fluent-api.md This example demonstrates creating a document and populating its fields with random values using traditional method calls, without the Fluent API. It serves as a comparison to the Fluent API approach. ```bsl Документ = Документы.ПриходТовара.СоздатьДокумент(); Документ.Поставщик = Поставщик; Документ.Дата = ЮТест.Данные().СлучайнаяДата(); Документ.Номер = ЮТест.Данные().СлучайнаяСтрока(); Документ.Склад = ЮТест.Данные().Фикция(Тип("СправочникСсылка.Склад")); Документ.Валюта = ЮТест.Данные().Фикция(Тип("СправочникСсылка.Валюты")); СтрокаТовары = Документ.Товары.Добавить(); СтрокаТовары.Товар = ЮТест.Данные().Фикция(Тип("СправочникСсылка.Товары"), Новый Структура("Поставщик", Поставщик)); СтрокаТовары.Цена = ЮТест.Данные().СлучайноеПоложительноеЧисло(); Документ.Записать(РежимЗаписиДокумента.Проведение); Ссылка = Документ.Ссылка; ``` -------------------------------- ### Add Repository for YaxUnit Plugin Installation Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/getting-started/install/install-plugin.md Use these repository URLs when adding a new software site in Eclipse (EDT) to install the YaxUnit plugin. Choose the appropriate tab for your development environment. ```url https://bia-technologies.github.io/edt-test-runner/repository ``` ```url https://bia-technologies.github.io/edt-test-runner/dev/repository ``` ```url https://bia-technologies.github.io/edt-test-runner/repository/updates/23.x ``` -------------------------------- ### Add Record and Continue Configuration Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/object-builder.md This method writes a new object to the database and returns the constructor, allowing further configuration of other objects or table parts. It's useful for chained data creation scenarios. Be aware that calling this multiple times without re-initializing the constructor will create duplicate objects. ```bsl ЮТест.Данные().КонструкторОбъекта("Документ.ПриходныйОрдер") .ФикцияОбязательныхПолей() .ДобавитьЗапись(Истина) // Записываем объект с признаком "ОбменДанными.Загрузка = Истина" .ТабличнаяЧасть("Товары") .ДобавитьСтроку() .Установить("Номенклатура", Справочники.Номенклатура.НайтиПоКоду("00001")) .ДобавитьЗапись(); // Записываем объект без признака "ОбменДанными.Загрузка" ``` -------------------------------- ### Create, Write, and Post Document Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/object-builder.md This method is used to create, write, and post a document. It returns the document object or a reference, similar to `Записать`. Use this when the document needs to be posted immediately after creation. ```bsl Ссылка = ЮТест.Данные().КонструкторОбъекта("Документ.ПриходныйОрдер") .ФикцияОбязательныхПолей() .Провести(); ``` -------------------------------- ### Read Tasks and Implementation Plan Source: https://github.com/bia-technologies/yaxunit/blob/develop/custom_modes/implement_instructions.md Loads the tasks and the overall implementation plan. Essential for understanding the scope and requirements of the build. ```javascript read_file({ target_file: "tasks.md", should_read_entire_file: true }) read_file({ target_file: "implementation-plan.md", should_read_entire_file: true }) ``` -------------------------------- ### Get Attribute Value Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/auxiliary-modules/queries.md Retrieves the value of a single attribute for a given reference. ```APIDOC ## ЮТЗапросы.ЗначениеРеквизита ### Description Returns the value of a reference attribute. ### Method `ЗначениеРеквизита(Ссылка, Реквизит)` ### Parameters #### Path Parameters - **Ссылка** (Reference) - Required - The reference to the object. - **Реквизит** (String) - Required - The name of the attribute. ### Request Example ```bsl ЮТест.ОжидаетЧто(ЮТЗапросы.ЗначениеРеквизита(Ссылка, "Наименование")) ``` ### Response #### Success Response (Any) - The value of the requested attribute. ### Response Example ```json "Наименование товара" ``` ``` -------------------------------- ### Read Main Rule and Tasks Source: https://github.com/bia-technologies/yaxunit/blob/develop/custom_modes/plan_instructions.md Reads the main rule file and the tasks file. Use this to initialize the planning process. ```javascript read_file({ target_file: ".cursor/rules/isolation_rules/main.mdc", should_read_entire_file: true }) read_file({ target_file: "tasks.md", should_read_entire_file: true }) ``` -------------------------------- ### Searching for a Random Contract Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md This example shows how to find a random contract of a specific type. ```APIDOC ## Searching for a Random Contract ### Description Finds a random contract of a specified type. ### Method `ЮТест.Данные().СлучайнаяСсылка("Справочник.ДоговорыКонтрагентов", Отбор)` ### Parameters - **МетаданныеОбъекта** (string) - Required - "Справочник.ДоговорыКонтрагентов" - **Отбор** (Structure) - Required - A structure containing filter criteria, e.g., `New Structure("ВидДоговора", Перечисления.ВидыДоговоровКонтрагентов.СПокупателем)`. ### Response - **Success Response (200)**: Returns a link to a random contract matching the criteria, or Undefined if none is found. - **Example**: `СлучайныйДоговор` ``` -------------------------------- ### Document Movement Constructor Example Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/index.md Use the Document Movement Constructor to create and populate document postings for testing. It allows for concise data formation and includes features for generating fictitious data for specific fields. ```bsl // Создание пустышки документа, будет использоваться в качестве регистратора Документ = ЮТест.Данные().СоздатьДокумент("Документы.УстановкаЦен"); // Формирование нужных проводок по регистру ЦеныТоваров ЮТест.Данные().КонструкторДвижений(Документ, "ЦеныТоваров") // Инициализация конструктора .ДобавитьСтроку() // Добавление записи в набор .ФикцияРеквизитов("Товар, ВидЦен") // Заполнение фиктивными данными .Установить("Цена", 0) // Установка цены .Записать(); // Сохранение // Создание дополнительных данных Документ = ЮТест.Данные().СоздатьДокумент("Документы.РасходТовара"); Покупатель = ЮТест.Данные().СоздатьЭлемент("Справочники.Контрагенты"); // Инициализация конструктора Конструктор = ЮТест.Данные().КонструкторДвижений(Документ, "Продажи"); // Заполнение движений Для Инд = 1 По 10 Цикл Конструктор .ДобавитьСтроку() .Установить("Покупатель", Покупатель) .ФикцияРеквизитов("Товар, Сумма"); КонецЦикла; // Сохранение записей в базе Конструктор.Записать(); ``` -------------------------------- ### Test for Creating a Catalog Item Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/assertions/assertions-db.md This example demonstrates how to test the creation of a catalog item. It first asserts that the item does not exist, then creates it, and finally asserts that it now exists and has populated fields. This approach provides clearer error messages than directly checking table contents. ```bsl ЮТест.ОжидаетЧтоТаблицаБазы("Справочник.Товары", "Товар уже существует в базе") .НеСодержитЗаписи(УсловиеПоискаТовара); // Выполнение тестируемого метода СоздатьТовар(АртикулТовара); // Проверка результата ЮТест.ОжидаетЧтоТаблицаБазы("Справочник.Товары", "Товар не был создан") .СодержитЗаписи(УсловиеПоискаТовара); // Проверим заполнение нового элемента СозданныйТовар = ЮТЗапрос.Запись("Справочник.Товары", УсловиеПоискаТовара); ЮТест.ОжидаетЧто(СозданныйТовар, "Данные нового товара") .Заполнено() .Свойство("Наименование").Заполнено() .Свойство("Код").Заполнено() .Свойство("Артикул").Заполнено(); ``` -------------------------------- ### Full Test Cycle with Mockito Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/mockito/mockito.md Demonstrates a complete test cycle using Mockito, including preparation, training the mock, running the test, and verifying the results. ```bsl // Подготовка Ответ = ЮТест.Данные().HTTPОтвет() .УстановитьКодСостояния(200) .УстановитьТело(Новый Структура("id, status", "9999", "delivered")); // Обучение Мокито Мокито.Обучение(ОтправкаСМС_Провайдер1) .Когда("УстановитьСоединение").Вернуть(Истина) .Когда("ПослатьСообщение").Вернуть(Ответ) .Прогон(); // Тестовый прогон РоботОтправки.ОтправкаСМС(); // Проверка статистики Мокито.Проверить(ОтправкаСМС_Провайдер1) .КоличествоВызовов("ПослатьСообщение") .Равно(1); ``` -------------------------------- ### Empty Parameter Array Example Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/mocking/mockito/mockito.md If a method has no parameters, an empty array can be used for the ParametersMethod parameter. ```bsl ПараметрыМетода = Новый Массив; ``` -------------------------------- ### Specify Metadata for Search by String Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md Example of using a string to specify the metadata object for the `СсылкаПоРеквизиту` method. ```bsl // 1. По строке Ссылка = ЮТест.Данные().СсылкаПоРеквизиту("Справочник.Контрагенты", "ИНН", "123"); ``` -------------------------------- ### Create a Query Description Object Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/auxiliary-modules/queries.md Initializes and configures a query description object for building custom queries. ```bsl ОписаниеЗапроса = ЮТЗапросы.ОписаниеЗапроса(); ОписаниеЗапроса.ИмяТаблицы = "Справочник.Товары"; ОписаниеЗапроса.Условия.Добавить("Ссылка = &Ссылка"); ОписаниеЗапроса.Условия.Добавить("НЕ ПометкаУдаления"); ОписаниеЗапроса.ЗначенияПараметров.Вставить("Ссылка", Товар); ``` -------------------------------- ### Full Test Method Implementation Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/cook-book/Forms/form-on-server.md This code demonstrates the complete test method. On the client, it opens a common form, passing the test method's address. On the server (when called from the form's creation handler), it executes the test logic and performs assertions. ```bsl Процедура ДействияНадФормой(Форма = Неопределено) Экспорт #Если Клиент Тогда // Шаг 1 // указываем путь к нашему тестовому методу в качестве параметра открытия формы ПараметрыФормы = Новый Структура("Метод", "yaxunit_ОбщегоНазначения.ДействияНадФормой(ЭтотОбъект)"); // открываем форму Форма = ОткрытьФорму("ОбщаяФорма.НашаОбщаяФорма", ПараметрыФормы); Форма.Закрыть(); #Иначе // Шаг 3 // в эту ветку мы попадаем уже после вызова тестового метода из обработчика модуля формы ПриСозданииНаСервере и имеем в своём распоряжении Форму // вызываем метод который мы хотим протестировать Результат = НашТестируемыйМетод(Форма); // Проверяем результат: // Допустим наш метод добавляет на форму Декорацию надпись и возвращает созданный элемент формы. ЮТест.ОжидаетЧто(Результат, "Создание декорации надпись") .Свойство("Вид").Равно(ВидДекорацииФормы.Надпись); #КонецЕсли КонецПроцедуры ``` -------------------------------- ### Using Predicates for Filtering Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md This example demonstrates how to use predicates to define complex filtering conditions for data searches. ```APIDOC ## Using Predicates for Filtering ### Description Predicates allow you to specify complex selection criteria for data searches, usable with methods like `СлучайнаяСсылка` and `Ссылка`. ### Method `ЮТест.Данные().СлучайнаяСсылка("Справочник.Контрагенты", Предикат)` ### Parameters - **МетаданныеОбъекта** (string) - Required - The metadata object for the search, e.g., `"Справочник.Контрагенты"`. - **Предикат** (Predicate Object) - Required - A predicate object defining the search conditions. Example: `ЮТест.Предикат().Реквизит("Наименование").Подобно("Тест%").Реквизит("ИНН").Равно("")`. ### Response - **Success Response (200)**: Returns a link to an object matching the predicate criteria, or Undefined. - **Example**: `СлучайныйКонтрагент` ``` -------------------------------- ### Specify Metadata for Search by Type Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md Example of using a type object to specify the metadata object for the `СсылкаПоРеквизиту` method. ```bsl // 4. По типу Ссылка = ЮТест.Данные().СсылкаПоРеквизиту(Тип("СправочникСсылка.Контрагенты"), "ИНН", "123"); ``` -------------------------------- ### Predicate Context in Method Parameters - Correct Usage Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/predicates.md Demonstrates the correct way to pass predicates as method parameters by ensuring each predicate instance is finalized with `.Получить()`. This guarantees that each parameter uses an independent context. ```bsl Мокито.Обучение(Модуль) .Когда(Модуль.СделатьЧтоТо( ЮТест.Предикат().ИмеетТип("Строка").Получить(), ЮТест.Предикат().ИмеетТип("Число").Получить())) .ВернутьРезультат(Результат1); ``` -------------------------------- ### Basic Test Case Configuration with Allure Properties Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/reports/allure-properties.md Demonstrates basic configuration of a test case using Allure properties like TestCaseId, Description, Severity, and Owner. ```bsl Процедура ИсполняемыеСценарии() Экспорт ЮТТесты .ДобавитьТестовыйНабор("ТестыДокументов") .ДобавитьТест("ТестСозданияДокумента") .Настроить(ЮТАлюр .TestCaseId("TC-001") .Description("Проверка создания нового документа") .Severity(ЮТАлюр.УровниСерьезности().Критический) .Owner("Иванов И.И.")); КонецПроцедуры ``` -------------------------------- ### Specify Metadata for Search by Manager Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md Example of using a manager object to specify the metadata object for the `СсылкаПоРеквизиту` method. ```bsl // 2. По менеджеру Ссылка = ЮТест.Данные().СсылкаПоРеквизиту(Справочники.Контрагенты, "ИНН", "123"); ``` -------------------------------- ### Command Line Override Example Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/getting-started/run/configuration.md Demonstrates how to override YAxUnit configuration parameters using the command line. Parameters are passed as key-value pairs separated by semicolons within the /C"RunUnitTests..." argument. ```bash /C"RunUnitTests[=путь_к_файлу.json|true];[параметр1]=[значение1];[параметр2]=[значение2]" ``` -------------------------------- ### Specify Metadata for Search by Metadata Object Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-search.md Example of using a metadata object to specify the metadata object for the `СсылкаПоРеквизиту` method. ```bsl // 3. По объекту метаданных Ссылка = ЮТест.Данные().СсылкаПоРеквизиту(Метаданные.Справочники.Контрагенты, "ИНН", "123"); ``` -------------------------------- ### Predicate Context Management - Correct Usage Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/predicates.md Illustrates the correct method for creating independent predicates by calling `.Получить()` after defining conditions. This ensures each predicate operates on its own isolated context. ```bsl УсловиеСтрока = ЮТест.Предикат().ИмеетТип("Строка").Получить(); УсловиеЧисло = ЮТест.Предикат().ИмеетТип("Число").Получить(); ``` -------------------------------- ### Get Record Attribute Value Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/auxiliary-modules/queries.md Retrieves the value of a specified attribute for the first record in a table that matches the given conditions. ```APIDOC ## ЮТЗапросы.ЗначениеРеквизитаЗаписи ### Description Returns the value of an attribute for the first record of a table matching the conditions. ### Method `ЗначениеРеквизитаЗаписи(ИмяТаблицы, Условие, Реквизит)` ### Parameters #### Path Parameters - **ИмяТаблицы** (String) - Required - The name of the table (e.g., "Справочник.Товары"). - **Условие** (Predicate) - Required - The condition to filter records. - **Реквизит** (String) - Required - The name of the attribute. ### Request Example ```bsl Предикат = ЮТест.Предикат().Реквизит("Поставщик").Равно(Данные.Поставщик); Значение = ЮТЗапросы.ЗначениеРеквизитаЗаписи("Справочник.Товары", Предикат, "Поставщик"); ``` ### Response #### Success Response (Any) - The value of the requested attribute for the matching record. ### Response Example ```json "ООО Ромашка" ``` ``` -------------------------------- ### Get Record Attribute Values Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/auxiliary-modules/queries.md Retrieves the values of specified attributes for the first record in a table that matches the given conditions. ```APIDOC ## ЮТЗапросы.ЗначенияРеквизитовЗаписи ### Description Returns the values of attributes for the first record of a table matching the conditions. ### Method `ЗначенияРеквизитовЗаписи(ИмяТаблицы, Условие, СписокРеквизитов)` ### Parameters #### Path Parameters - **ИмяТаблицы** (String) - Required - The name of the table (e.g., "Справочник.Товары"). - **Условие** (Predicate) - Required - The condition to filter records. - **СписокРеквизитов** (String) - Required - A comma-separated list of attribute names. ### Request Example ```bsl Предикат = ЮТест.Предикат().Реквизит("Штрихкод").Равно(Данные.Штрихкод); ДанныеСсылки = ЮТЗапросы.ЗначенияРеквизитовЗаписи("Справочник.Товары", Предикат, "Штрихкод, Поставщик, Поставщик.Наименование"); ``` ### Response #### Success Response (Structure) - A structure containing the values of the requested attributes for the matching record. ### Response Example ```json { "Штрихкод": "12345", "Поставщик": "ООО Ромашка", "ПоставщикНаименование": "ООО Ромашка" } ``` ``` -------------------------------- ### Object Constructor with Data Source: https://github.com/bia-technologies/yaxunit/blob/develop/documentation/docs/features/test-data/data-generation/index.md Demonstrates using the object constructor to set properties like 'Наименование' and 'Идентификатор' with randomly generated data before saving the object. ```bsl // Использование в конструкторе объекта Конструктор = ЮТест.Данные().КонструкторОбъекта("Справочники.Товары") .Установить("Наименование", "Товар " + ЮТест.Данные().СлучайнаяСтрока()) .Установить("Идентификатор", ЮТест.Данные().Фикция(Тип("УникальныйИдентификатор"))) .Записать(); ```