Skip to content

Commit

Permalink
Merge branch 'feature/issue-1131' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Asakra committed Nov 23, 2023
2 parents 93f65c9 + e178cd3 commit fb37116
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ Procedure ЗаполнитьНаборТестов(TestsSet, CoreContextParam) E
CoreContext = CoreContextParam;

LoadSettings();
LoadSubsystemTests(TestsSet, Settings.Subsystems);
LoadSmokeCommonModuleTests(TestsSet, Settings.Subsystems,
Settings.ExcludedCommonModules);

LoadSubsystemTests(TestsSet, Settings.Subsystems);

FavouritesCommonModules = LoadFavouritesCommonModules(Settings.FavouritesCommonModules);

LoadSmokeCommonModuleTests(
TestsSet,
Settings.Subsystems,
Settings.ExcludedCommonModules,
FavouritesCommonModules);

EndProcedure // ЗаполнитьНаборТестов()

#EndRegion // ServiceInterface
Expand Down Expand Up @@ -680,13 +686,35 @@ Procedure LoadSettings()
EndIf;

If Not Settings.Property("ExcludedCommonModules") Then
Settings.Insert("ExcludedCommonModules", New Array);
Settings.Insert("ExcludedCommonModules", New Array);
EndIf;

If Not Settings.Property("FavouritesCommonModules") Then
Settings.Insert("FavouritesCommonModules", New Array);
EndIf;

Settings = New FixedStructure(Settings);

EndProcedure // LoadSettings()

Function LoadFavouritesCommonModules(FavouritesCommonModules)

Result = New Map;

If FavouritesCommonModules.Count() > 0 Then

For Each CommonModule In Metadata.CommonModules Do
If CoreContext.ЕстьВИсключаемойКоллекции(CommonModule.Name, FavouritesCommonModules) Then
Result.Insert(CommonModule.Name, True);
EndIf;
EndDo;

EndIf;

Return Result;

EndFunction

// Only for internal use.
//
Procedure AddSmokeCommonModuleTest(TestsSet, CommonModule)
Expand Down Expand Up @@ -779,14 +807,20 @@ EndProcedure // LoadSubsystemTests()

// Only for internal use.
//
Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,
ExcludedCommonModules)
Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,
ExcludedCommonModules, FavouritesCommonModules)

If Subsystems.Find("*") <> Undefined Then

ExistFavouritesCommonModules = (FavouritesCommonModules.Count() > 0);

GroupCommonModulesNotExists = True;
For Each CommonModule In Metadata.CommonModules Do

If ExistFavouritesCommonModules And FavouritesCommonModules.Get(CommonModule.Name) = Undefined Then
Continue;
EndIf;

If ExcludedCommonModules.Find(CommonModule.Name) <> Undefined Then
Continue;
EndIf;
Expand Down Expand Up @@ -846,17 +880,19 @@ Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,

GroupCommonModulesNotExists = True;
If OnlySubordinate Then
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);
Else
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);
EndIf;

EndDo;
Expand All @@ -865,15 +901,21 @@ EndProcedure // LoadSmokeCommonModuleTests()

// Only for internal use.
//
Procedure LoadSmokeCommonModuleTestsFromSubsystem(TestsSet, Subsystem,
SubsystemName, ExcludedCommonModules, GroupCommonModulesNotExists)
Procedure LoadSmokeCommonModuleTestsFromSubsystem(TestsSet, Subsystem,
SubsystemName, ExcludedCommonModules, FavouritesCommonModules, GroupCommonModulesNotExists)

ExistFavouritesCommonModules = (FavouritesCommonModules.Count() > 0);

CommonModules = Metadata.CommonModules;
For Each Item In Subsystem.Content Do

FullName = Item.FullName();
If Find(FullName, "CommonModule") <> 0
Or Find(FullName, "ОбщийМодуль") <> 0 Then
Or Find(FullName, "ОбщийМодуль") <> 0 Then

If ExistFavouritesCommonModules And FavouritesCommonModules.Get(Item.Name) = Undefined Then
Continue;
EndIf;

If ExcludedCommonModules.Find(Item.Name) <> Undefined Then
Continue;
Expand Down Expand Up @@ -901,22 +943,24 @@ EndProcedure // LoadSmokeCommonModuleTestsFromSubsystem()

// Only for internal use.
//
Procedure RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem, SubsystemName, ExcludedCommonModules, GroupCommonModulesNotExists)
Procedure RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem, SubsystemName, ExcludedCommonModules, FavouritesCommonModules, GroupCommonModulesNotExists)

For Each Subsystem In ParentSubsystem.Subsystems Do

LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
Subsystem,
SubsystemName,
ExcludedCommonModules,
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);

RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
Subsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);

EndDo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,30 @@ EndProcedure // Инициализация()
// CoreContextParam - ExternalDataProcessorObject.xddTestRunner - test runner data processor.
//
Procedure ЗаполнитьНаборТестов(TestsSet, CoreContextParam) Export
If CurrentRunMode() = ClientRunMode.OrdinaryApplication Then
Return;
EndIf;
If CurrentRunMode() = ClientRunMode.OrdinaryApplication Then
Return;
EndIf;
CoreContext = CoreContextParam;

LoadSettings();

Если Не НужноВыполнятьТест() Тогда
Возврат;
КонецЕсли;

LoadSubsystemTests(TestsSet, Object.Settings.Subsystems);
LoadSmokeCommonModuleTests(TestsSet, Object.Settings.Subsystems, Object.Settings.ExcludedCommonModules);


Если Не НужноВыполнятьТест() Тогда
Возврат;
КонецЕсли;

Settings = Object.Settings;

FavouritesCommonModules = LoadFavouritesCommonModules(Settings.FavouritesCommonModules);

LoadSubsystemTests(TestsSet, Settings.Subsystems);
LoadSmokeCommonModuleTests(
TestsSet,
Settings.Subsystems,
Settings.ExcludedCommonModules,
FavouritesCommonModules);

EndProcedure // ЗаполнитьНаборТестов()

#EndRegion // ServiceInterface
Expand Down Expand Up @@ -530,6 +538,25 @@ Procedure LoadSettings()

EndProcedure // LoadSettings()

&AtClient
Function LoadFavouritesCommonModules(FavouritesCommonModules)

Result = New Map;

If FavouritesCommonModules.Count() > 0 Then

For Each CommonModule In CommonModules() Do
If CoreContext.ЕстьВИсключаемойКоллекции(CommonModule.Name, FavouritesCommonModules) Then
Result.Insert(CommonModule.Name, True);
EndIf;
EndDo;

EndIf;

Return Result;

EndFunction

&НаКлиенте
Функция НужноВыполнятьТест()

Expand Down Expand Up @@ -651,14 +678,20 @@ EndProcedure // LoadSubsystemTests()
&AtClient
// Only for internal use.
//
Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,
ExcludedCommonModules)
Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,
ExcludedCommonModules, FavouritesCommonModules)

If Subsystems.Find("*") <> Undefined Then

ExistFavouritesCommonModules = (FavouritesCommonModules.Count() > 0);

GroupCommonModulesNotExists = True;
For Each CommonModule In CommonModules() Do

If ExistFavouritesCommonModules And FavouritesCommonModules.Get(CommonModule.Name) = Undefined Then
Continue;
EndIf;

If ExcludedCommonModules.Find(CommonModule.Name) <> Undefined Then
Continue;
EndIf;
Expand Down Expand Up @@ -718,17 +751,19 @@ Procedure LoadSmokeCommonModuleTests(TestsSet, Subsystems,

GroupCommonModulesNotExists = True;
If OnlySubordinate Then
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);
Else
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);
EndIf;

EndDo;
Expand All @@ -738,15 +773,21 @@ EndProcedure // LoadSmokeCommonModuleTests()
&AtClient
// Only for internal use.
//
Procedure LoadSmokeCommonModuleTestsFromSubsystem(TestsSet, Subsystem,
SubsystemName, ExcludedCommonModules, GroupCommonModulesNotExists)
Procedure LoadSmokeCommonModuleTestsFromSubsystem(TestsSet, Subsystem,
SubsystemName, ExcludedCommonModules, GroupCommonModulesNotExists, FavouritesCommonModules)

ExistFavouritesCommonModules = (FavouritesCommonModules.Count() > 0);

CommonModules = CommonModules();
For Each Item In SubsystemContent(SubsystemName) Do

FullName = Item.FullName;
If Find(FullName, "CommonModule") <> 0
Or Find(FullName, "ОбщийМодуль") <> 0 Then
Or Find(FullName, "ОбщийМодуль") <> 0 Then

If ExistFavouritesCommonModules And FavouritesCommonModules.Get(Item.Name) = Undefined Then
Continue;
EndIf;

If ExcludedCommonModules.Find(Item.Name) <> Undefined Then
Continue;
Expand Down Expand Up @@ -775,22 +816,24 @@ EndProcedure // LoadSmokeCommonModuleTestsFromSubsystem()
&AtClient
// Only for internal use.
//
Procedure RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem, SubsystemName, ExcludedCommonModules, GroupCommonModulesNotExists)
Procedure RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
ParentSubsystem, SubsystemName, ExcludedCommonModules, FavouritesCommonModules, GroupCommonModulesNotExists)

For Each Subsystem In ParentSubsystem.Subsystems Do

LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
LoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
Subsystem,
SubsystemName,
ExcludedCommonModules,
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);

RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
RecursivelyLoadSmokeCommonModuleTestsFromSubsystem(TestsSet,
Subsystem,
SubsystemName,
ExcludedCommonModules,
GroupCommonModulesNotExists);
SubsystemName,
ExcludedCommonModules,
FavouritesCommonModules,
GroupCommonModulesNotExists);

EndDo;

Expand Down

0 comments on commit fb37116

Please sign in to comment.