Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
martonsagi committed Mar 14, 2023
2 parents 89ba79d + 3176e53 commit 098e639
Show file tree
Hide file tree
Showing 66 changed files with 314 additions and 357 deletions.
45 changes: 45 additions & 0 deletions test/test-project/test/TestObjectHoleInScenarioNos.Codeunit.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
codeunit 50109 "TestObjectHoleInScenarioNosFLX"
{
Subtype = Test;

var
IsInitialized: Boolean;

trigger OnRun()
begin
// [FEATURE] Feature
end;

[Test]
procedure TestFunctionForScenario1()
// [FEATURE] Feature
begin
// [SCENARIO 0001] Test function for scenario 1
Initialize();
end;

[Test]
procedure TestFunctionorScenario3()
// [FEATURE] Feature
begin
// [SCENARIO 0003] Test function for scenario 3
Initialize();
end;

local procedure Initialize()
var
LibraryTestInitialize: Codeunit "Library - Test Initialize";
begin
LibraryTestInitialize.OnTestInitialize(Codeunit::"TestObjectHoleInScenarioNosFLX");

if IsInitialized then
exit;

LibraryTestInitialize.OnBeforeTestSuiteInitialize(Codeunit::"TestObjectHoleInScenarioNosFLX");

IsInitialized := true;
Commit();

LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"TestObjectHoleInScenarioNosFLX");
end;
}
6 changes: 3 additions & 3 deletions test/test-project/test/TestObjectWithInitialize.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ codeunit 50103 "TestObjectWithInitializeFLX"
var
LibraryTestInitialize: Codeunit "Library - Test Initialize";
begin
LibraryTestInitialize.OnTestInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnTestInitialize(Codeunit::"TestObjectWithInitializeFLX");

if IsInitialized then
exit;

LibraryTestInitialize.OnBeforeTestSuiteInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnBeforeTestSuiteInitialize(Codeunit::"TestObjectWithInitializeFLX");

IsInitialized := true;
Commit();

LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"TestObjectWithInitializeFLX");
end;

local procedure CreateValidGiven()
Expand Down
6 changes: 3 additions & 3 deletions test/test-project/test/TestObjectWithUIHandler.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ codeunit 50104 "TestObjectWithUIHandlerFLX"
var
LibraryTestInitialize: Codeunit "Library - Test Initialize";
begin
LibraryTestInitialize.OnTestInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnTestInitialize(Codeunit::"TestObjectWithInitializeFLX");

if IsInitialized then
exit;

LibraryTestInitialize.OnBeforeTestSuiteInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnBeforeTestSuiteInitialize(Codeunit::"TestObjectWithInitializeFLX");

IsInitialized := true;
Commit();

LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::TestObjectWithInitializeFLX);
LibraryTestInitialize.OnAfterTestSuiteInitialize(Codeunit::"TestObjectWithInitializeFLX");
end;

local procedure CreateValidGiven()
Expand Down
Binary file modified test/test-scenarios/atdd-test-scenarios-and-results.xlsx
Binary file not shown.
2 changes: 1 addition & 1 deletion vscode-extension/src/App logic/Utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Config {
return this.getConfig().get<boolean>('showConfirmations', true);
}
static setShowConfirmations(newValue: boolean) {
this.getConfig().update('showConfirmations', newValue, ConfigurationTarget.Workspace);
this.getConfig().update('showConfirmations', newValue, ConfigurationTarget.Global);
}
private static getConfig(uri?: Uri): WorkspaceConfiguration {
return workspace.getConfiguration(this.app, uri);
Expand Down
53 changes: 27 additions & 26 deletions vscode-extension/src/test/atddTestScenariosAndResults_Add.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ suite('Add', function () {
await TestHelper.resetConfigurations();
});

test('Scenario001', async () => {
test('Scenario 001 - Add New Given', async () => {
//Given Test function with valid Given-When-Then structure
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When Add Given "New Given"
let messageUpdate: MessageUpdate = {
Scenario: 'First test function with valid Given-When-Then structure',
Expand All @@ -28,9 +28,9 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario001.al');
})
test('Scenario002', async () => {
test('Scenario 002 - Add New Given 2', async () => {
//Given Result from scenario 1
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When Add Given "New Given 2"
let messageUpdate: MessageUpdate = {
Scenario: 'First test function with valid Given-When-Then structure',
Expand All @@ -45,10 +45,10 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario002.al');
})
test('Scenario003', async () => {
test('Scenario 003 - Add duplicate Given', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When Add Given "Valid Given"
let messageUpdate: MessageUpdate = {
Scenario: 'First test function with valid Given-When-Then structure',
Expand All @@ -63,11 +63,11 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario003.al');
})
test('Scenario010', async () => {
test('Scenario 010 - Add New Given with non-alphabetic or non-numerical characters', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles()

let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When Add Given "New Given !@#$%^&*()"
let messageUpdate: MessageUpdate = {
Scenario: 'First test function with valid Given-When-Then structure',
Expand All @@ -82,11 +82,11 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario010.al');
})
test('Scenario012', async () => {
test('Scenario 012 - Add New Given with only lowercase characters', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles()

let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When Add Given "new given all lowercase"
let messageUpdate: MessageUpdate = {
Scenario: 'First test function with valid Given-When-Then structure',
Expand All @@ -101,11 +101,11 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario012.al');
})
test('Scenario014', async () => {
test('Scenario 014 - Given prefix', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles()

let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Setting atddTestScriptor.prefixGiven equals Make
await workspace.getConfiguration('atddTestScriptor', Uri.file(TestHelper.pathOfTestProject)).update('prefixGiven', 'Make');

Expand All @@ -123,11 +123,11 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario014.al');
})
test('Scenario061', async () => {
test('Scenario 061 - Given helper function with no exception', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles()

let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Setting atddTestScriptor.addException equals false
await workspace.getConfiguration('atddTestScriptor', Uri.file(TestHelper.pathOfTestProject)).update('addException', false);

Expand All @@ -145,11 +145,12 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario061.al');
})
test('Scenario004', async () => {

test('Scenario 004 - Add New Then', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles()

let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')

//When Add Then "New Then"
let messageUpdate: MessageUpdate = {
Expand All @@ -165,9 +166,9 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario004.al');
})
test('Scenario005', async () => {
test('Scenario 005 - Add New Then 2', async () => {
//Given Result from scenario 4
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')

//When Add Then "New Then 2"
let messageUpdate: MessageUpdate = {
Expand All @@ -183,10 +184,10 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario005.al');
})
test('Scenario011', async () => {
test('Scenario 011 - Add New Then with non-alphabetic or non-numerical characters', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')

//When Add Then "New Then !@#$%^&*()"
let messageUpdate: MessageUpdate = {
Expand All @@ -202,10 +203,10 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario011.al');
})
test('Scenario013', async () => {
test('Scenario 013 - Add New Then with only lowercase characters', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')

//When Add Then "new then all lowercase"
let messageUpdate: MessageUpdate = {
Expand All @@ -221,10 +222,10 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario013.al');
})
test('Scenario015', async () => {
test('Scenario 015 - Then prefix', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Setting atddTestScriptor.prefixThen equals Check
await workspace.getConfiguration('atddTestScriptor', Uri.file(TestHelper.pathOfTestProject)).update('prefixThen', 'Check')

Expand All @@ -242,10 +243,10 @@ suite('Add', function () {
//Then
await TestHelper.verifyResult(messageUpdate, 'scenario015.al');
})
test('Scenario062', async () => {
test('Scenario 062 - Then helper function with no exception', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Setting atddTestScriptor.addException equals false
await workspace.getConfiguration('atddTestScriptor', Uri.file(TestHelper.pathOfTestProject)).update('addException', false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ suite('AddFeature', function () {
await TestHelper.resetConfigurations();
});

test('Scenario086', async () => {
test('Scenario 086 - Add Feature 2a', async () => {
//Given Test Directory
await workspace.getConfiguration('atddTestScriptor', Uri.file(TestHelper.pathOfTestProject)).update('testDirectory', 'src/codeunit')
//When User selects "Add Scenario" action
Expand All @@ -27,6 +27,6 @@ suite('AddFeature', function () {
}
//Then
await TestHelper.verifyChangeIsValid(messageUpdate);
await TestHelper.verifyResult(messageUpdate, 'scenario086.al');
await TestHelper.verifyResult(messageUpdate, 'scenario086.al', true);
})
});
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ suite('AddScenario', function () {
await TestHelper.resetConfigurations();
});

test('Scenario055', async () => {
test('Scenario 055 - Add Scenario (to existing test codeunit with 1 feature)', async () => {
//Given Test function with valid Given-When-Then structure
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When User selects "Add Scenario" action
let messageUpdate: MessageUpdate = {
Scenario: '',
Expand All @@ -30,9 +30,9 @@ suite('AddScenario', function () {
await TestHelper.verifyChangeIsValid(messageUpdate);
await TestHelper.verifyResult(messageUpdate, 'scenario055.al');
})
test('Scenario073', async () => {
test('Scenario 073 - Add another Scenario (to existing test codeunit with 1 feature)', async () => {
//Given Result from scenario 55
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//When User selects "Add Scenario" action
let messageUpdate: MessageUpdate = {
Scenario: '',
Expand All @@ -49,10 +49,10 @@ suite('AddScenario', function () {
await TestHelper.verifyChangeIsValid(messageUpdate);
await TestHelper.verifyResult(messageUpdate, 'scenario073.al');
})
test('Scenario078', async () => {
test('Scenario 078 - Add Scenario (to existing test codeunit with 1 feature) with Given-When-Then', async () => {
//Given Test function with valid Given-When-Then structure
await TestHelper.resetFiles();
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Added scenario
let messageUpdate: MessageUpdate = {
Scenario: '',
Expand Down Expand Up @@ -87,9 +87,9 @@ suite('AddScenario', function () {
await TestHelper.verifyChangeIsValid(messageUpdate);
await TestHelper.verifyResult(messageUpdate, 'scenario078.al');
})
test('Scenario079', async () => {
test('Scenario 079 - Add another Scenario (to existing test codeunit with 1 feature) with Given-When-Then', async () => {
//Given Test function with valid Given-When-Then structure
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObjectFLX.Codeunit.al')
let fsPath: string = TestHelper.getFsPathOfTestProject('TestObject.Codeunit.al')
//Given Added scenario
let messageUpdate: MessageUpdate = {
Scenario: '',
Expand Down
Loading

0 comments on commit 098e639

Please sign in to comment.