Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating correct correlationId when suite name is overridden #461

Merged
merged 8 commits into from
Feb 15, 2019
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to AET will be documented in this file.
- [PR-363](https://github.com/Cognifide/aet/pull/363) Fixed saving case-level notes
- [PR-470](https://github.com/Cognifide/aet/pull/470) Security vulnerabilities fix ([#407](https://github.com/Cognifide/aet/issues/407))
- [PR-468](https://github.com/Cognifide/aet/pull/468) Add loggers in collector/modifier ([#446](https://github.com/Cognifide/aet/issues/446))
- [PR-461](https://github.com/Cognifide/aet/pull/461) Generating correct correlationId when suite name is overridden([#440](https://github.com/Cognifide/aet/issues/440))

## Version 3.2.0

Expand All @@ -31,7 +32,7 @@ All notable changes to AET will be documented in this file.
- [PR-404](https://github.com/Cognifide/aet/pull/404) Added missing tooltip for conditional tests
- [PR-408](https://github.com/Cognifide/aet/pull/408) Advanced Screen Comparision button layout fix
- [PR-410](https://github.com/Cognifide/aet/pull/410) Notification that displays when exclude-elements are not found on page now shows what specific elements were not found([#372](https://github.com/Cognifide/aet/issues/372))

## Version 3.1.0

- [PR-409](https://github.com/Cognifide/aet/pull/409) Added sources link in "view source" url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ public TestSuiteRun(String name, String company, String project, String domain,
}

public TestSuiteRun(TestSuiteRun testSuiteRun, String name, String domain, List<TestRun> tests) {
this.name = name;
this.company = testSuiteRun.getCompany();
this.project = testSuiteRun.getProject();
this.domain = domain;
this.correlationId = testSuiteRun.getCorrelationId();
this.testRunMap = getMap(tests);
this(name, testSuiteRun.getCompany(), testSuiteRun.getProject(), domain, tests);
}

private Map<String, TestRun> getMap(List<TestRun> testRunList) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.cognifide.aet.executor.model;

import org.junit.Test;

import java.util.Collections;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;

public class TestSuiteRunTest {

@Test
public void constructor_whenOverridingNameAndDomain_expectUpdatedValues() {
String company = "company";
String project = "project";
String name = "abcd";
String domain = "ijkl";
TestSuiteRun baseSuiteRun = new TestSuiteRun(name, company, project, domain, Collections.emptyList());

String newName = "efgh";
String newDomain = "mnop";
TestSuiteRun updatedSuiteRun = new TestSuiteRun(baseSuiteRun, newName, newDomain, Collections.emptyList());
String correlationRegex = String.format("^%s-%s-%s-[0-9]*$", company, project, newName);

assertThat(updatedSuiteRun.getName(), equalTo(newName));
assertThat(updatedSuiteRun.getDomain(), equalTo(newDomain));
assertThat(updatedSuiteRun.getCorrelationId(), updatedSuiteRun.getCorrelationId().matches(correlationRegex));
}

}