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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* **(breaking change)** [#246 Changes to ConfigValueHandlerPhased](https://github.com/adobe/phased-testing/issues/246). The public field `ConfigValueHandlerPhased.deprecatedSystemName` has been renamed to `legacySystemName`, to reflect that these are old property names still fully supported, not deprecated ones. In addition, `MutationListener` now proactively checks all config values at suite start and logs a warning for any legacy property name that is in use, rather than only warning the first time the value is fetched.
* [#251 Add a boolean to ConfigValueHandler that is deprecation](https://github.com/adobe/phased-testing/issues/251). `ConfigValueHandlerPhased` now has a `description` field (populated for every config value) and a `deprecated` boolean, to distinguish a property whose usage itself is going away from one that has simply been renamed (see #246). `PHASED.TESTS.PHASE` and `PHASED.TESTS.NONPHASED.LEGACY` are marked deprecated. `MutationListener` now also warns at suite start if a deprecated property is set, using its description to explain why.
* [#227 NIE: rename waitTillFinished to a better wording](https://github.com/adobe/phased-testing/issues/227). `NonInterruptiveEvent.waitTillFinished()` has been renamed to `waitTillStarted()`, since it waits for the startUp stage to be finalized rather than for the event to finish. `waitTillFinished()` is now `@Deprecated` and still fully functional (it forwards to/from `waitTillStarted()`), so existing subclasses of `NonInterruptiveEvent` do not need to change. It will be removed in a future major version.
* [#106 Include factory in the filters for the order](https://github.com/adobe/phased-testing/issues/106). `@DataProvider` and `@Factory` annotated methods are now excluded from Permutation Execution Mode step ordering, the same way `@Before*`/`@After*` methods already are.

* **New Environment Variables**
* MUTATIONAL.EXECUTION.MODE : This property is used to set the execution mode of the Mutational Tests. The value can be one of the following: STANDARD, INTERRUPTIVE(PRODUCER), INTERRUPTIVE(CONSUMER), NON-INTERRUPTIVE, PERMUATIONAL. This will replace the PHASED.TESTS.PHASE property which will be removed in 9.X.3.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class ScenarioStepDependencyFactory {
private static final List<Class> CONFIG_CLASSES = Arrays.asList(BeforeClass.class, BeforeMethod.class,
BeforeSuite.class, BeforeGroups.class,
BeforeTest.class, AfterClass.class, AfterMethod.class, AfterSuite.class, AfterGroups.class,
AfterTest.class);
AfterTest.class, DataProvider.class, Factory.class);

/**
* From a class, this method returns the methods, and what they produce / consume
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2022 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it.
*/
package com.adobe.campaign.tests.integro.phased.data.permutational;

import com.adobe.campaign.tests.integro.phased.PhasedTestManager;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;

public class ProducerConsumerWithDataProviderAndFactory {
@Factory
public Object[] createInstances() {
return new Object[0];
}

@DataProvider(name = "myDataProvider")
public Object[][] provideData() {
return new Object[][] { { "value" } };
}

public void bbbbb(Object param) {

Check warning on line 26 in phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/permutational/ProducerConsumerWithDataProviderAndFactory.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused method parameter "param".

See more on https://sonarcloud.io/project/issues?id=adobe_phased-testing&issues=AaBZV8WIXg9wHN5M8e_j&open=AaBZV8WIXg9wHN5M8e_j&pullRequest=262
PhasedTestManager.produce("bbbbkey","bbbbValue");
}

public void aaaa(Object param) {

Check warning on line 30 in phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/data/permutational/ProducerConsumerWithDataProviderAndFactory.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this unused method parameter "param".

See more on https://sonarcloud.io/project/issues?id=adobe_phased-testing&issues=AaBZV8WIXg9wHN5M8e_k&open=AaBZV8WIXg9wHN5M8e_k&pullRequest=262
PhasedTestManager.consume("bbbbkey");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,32 @@
Collectors.toList()), contains("bbbbb", "aaaa"));
}

@Test
public void testFetchExtractingProduceConsumeWithDataProviderAndFactory()
throws NoSuchMethodException, SecurityException, IOException {

Class<ProducerConsumerWithDataProviderAndFactory> l_testClass = ProducerConsumerWithDataProviderAndFactory.class;

Check warning on line 314 in phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/stepdependencies/TestExtractingDependencies.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Rename this local variable to match the regular expression '^[a-z][a-zA-Z0-9]*$'.

See more on https://sonarcloud.io/project/issues?id=adobe_phased-testing&issues=AaBZV8W6Xg9wHN5M8e_l&open=AaBZV8W6Xg9wHN5M8e_l&pullRequest=262

ScenarioStepDependencies dependencies = ScenarioStepDependencyFactory.listMethodCalls(l_testClass);

assertThat("We should have fetched the correct methods", dependencies.getStepDependencies().keySet(),
containsInAnyOrder("createInstances", "provideData", "bbbbb", "aaaa"));

assertThat("The @Factory method should be a config method",
dependencies.getStep("createInstances").isConfigMethod());
assertThat("The @DataProvider method should be a config method",
dependencies.getStep("provideData").isConfigMethod());
assertThat("This test should be a test", !dependencies.getStep("bbbbb").isConfigMethod());
assertThat("This test should be a test", !dependencies.getStep("aaaa").isConfigMethod());

assertThat("The ordered set should exclude @Factory and @DataProvider methods",
dependencies.fetchExecutionOrderList().stream().map(f -> f.getStepName()).collect(
Collectors.toList()), contains("bbbbb", "aaaa"));
}

@Test
public void testListMethodCalls_negativeFileNotFound()
throws NoSuchMethodException, SecurityException, IOException {

Check warning on line 335 in phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/stepdependencies/TestExtractingDependencies.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the declaration of thrown exception 'java.lang.NoSuchMethodException', as it cannot be thrown from method's body.

See more on https://sonarcloud.io/project/issues?id=adobe_phased-testing&issues=AaBZV8W6Xg9wHN5M8e_m&open=AaBZV8W6Xg9wHN5M8e_m&pullRequest=262

Check warning on line 335 in phased-testing-testng/src/test/java/com/adobe/campaign/tests/integro/phased/stepdependencies/TestExtractingDependencies.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove the declaration of thrown exception 'java.io.IOException', as it cannot be thrown from method's body.

See more on https://sonarcloud.io/project/issues?id=adobe_phased-testing&issues=AaBZV8W6Xg9wHN5M8e_n&open=AaBZV8W6Xg9wHN5M8e_n&pullRequest=262

Class<ProducerConsumerWithBeforeClass> l_testClass = ProducerConsumerWithBeforeClass.class;
ConfigValueHandlerPhased.PHASED_TEST_SOURCE_LOCATION.activate("/nonExistingDirectory");
Expand Down
Loading