Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion experiments.json
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
[]
[
{
"name": "AlwaysDisplayTestExplorer - experiment",
"salt": "AlwaysDisplayTestExplorer",
"min": 80,
"max": 100
},
{
"name": "AlwaysDisplayTestExplorer - control",
"salt": "AlwaysDisplayTestExplorer",
"min": 0,
"max": 20
}
]
2 changes: 1 addition & 1 deletion src/client/common/experimentGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export const LSEnabled = 'LS - enabled';
// Experiment to check whether to always display the test explorer.
export enum AlwaysDisplayTestExplorerGroups {
control = 'AlwaysDisplayTestExplorer - control',
enabled = 'AlwaysDisplayTestExplorer - enabled'
experiment = 'AlwaysDisplayTestExplorer - experiment'
}
2 changes: 1 addition & 1 deletion src/client/testing/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class UnitTestManagementService implements ITestManagementService, Dispos
}
public checkExperiments() {
const experiments = this.serviceContainer.get<IExperimentsManager>(IExperimentsManager);
if (experiments.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)) {
if (experiments.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)) {
const commandManager = this.serviceContainer.get<ICommandManager>(ICommandManager);
commandManager.executeCommand('setContext', 'testsDiscovered', true).then(noop, noop);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/test/testing/main.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ suite('Unit Tests - ManagementService', () => {
});

test('Execute command if in experiment', async () => {
when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).thenReturn(true);
when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).thenReturn(true);

await testManagementService.activate(instance(mock(JediSymbolProvider)));

verify(commandManager.executeCommand('setContext', 'testsDiscovered', true)).once();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).once();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).once();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.control)).never();
verify(experiment.sendTelemetryIfInExperiment(anything())).never();
});
test('If not in experiment, check and send Telemetry for control group and do not execute command', async () => {
when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).thenReturn(false);
when(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).thenReturn(false);

await testManagementService.activate(instance(mock(JediSymbolProvider)));

verify(commandManager.executeCommand('setContext', 'testsDiscovered', anything())).never();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.enabled)).once();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.experiment)).once();
verify(experiment.inExperiment(AlwaysDisplayTestExplorerGroups.control)).never();
verify(experiment.sendTelemetryIfInExperiment(AlwaysDisplayTestExplorerGroups.control)).once();
});
Expand Down