You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/04/13 21:03:22 UTC
[isis-app-simpleapp] 02/03: removes BDD tests
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch jdo
in repository https://gitbox.apache.org/repos/asf/isis-app-simpleapp.git
commit 08d9e21bf29e33539518973b535fd15d16b82a15
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Tue Apr 13 20:49:55 2021 +0100
removes BDD tests
(cherry picked from commit 6af6922ffca3e7f1d848ba6f28dfeb2747a19492)
---
webapp-tests/pom.xml | 66 +---------------------
.../domainapp/webapp/bdd/CucumberTestAbstract.java | 34 -----------
.../domainapp/webapp/bdd/specs/CucumberTest.java | 36 ------------
.../webapp/bdd/stepdefs/BddStepDefsModule.java | 13 -----
.../bdd/stepdefs/domain/SimpleObjectsContext.java | 21 -------
.../domain/SimpleObjectsGivenThenStepDef.java | 54 ------------------
.../stepdefs/domain/SimpleObjectsWhenStepDef.java | 41 --------------
.../stepdefs/fixtures/DomainAppDemoStepDef.java | 21 -------
.../stepdefs/infrastructure/BootstrapStepDef.java | 14 -----
.../infrastructure/TransactionalStepDef.java | 50 ----------------
.../webapp/integtests/WebAppIntegTestAbstract.java | 2 -
.../SimpleObjectSpec_listAllAndCreate.feature | 14 -----
.../bdd/specs/SimpleObjectSpec_updateName.feature | 16 ------
13 files changed, 1 insertion(+), 381 deletions(-)
diff --git a/webapp-tests/pom.xml b/webapp-tests/pom.xml
index f5f72ef..8890541 100644
--- a/webapp-tests/pom.xml
+++ b/webapp-tests/pom.xml
@@ -12,7 +12,7 @@
<name>SimpleApp (JDO) - Webapp (tests)</name>
<description>
- Integ tests and BDD specs for entire app.
+ Integ tests for entire app.
</description>
<packaging>jar</packaging>
@@ -30,63 +30,6 @@
</excludes>
</testResource>
</testResources>
- <plugins>
-
- <!-- generate cucumber json result -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>cucumber-cli</id>
- <phase>integration-test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <skip>${skipBDD}</skip>
- <target>
- <echo message="Running Cucumber CLI" />
- <java classname="io.cucumber.core.cli.Main"
- fork="true"
- failonerror="true"
- newenvironment="true"
- maxmemory="1024m"
- classpathref="maven.test.classpath">
- <arg value="--plugin" />
- <arg value="json:${project.build.directory}/cucumber-no-clobber.json" />
- </java>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <!-- generate html report from cucumber json result -->
- <plugin>
- <groupId>net.masterthought</groupId>
- <artifactId>maven-cucumber-reporting</artifactId>
- <version>${maven-cucumber-reporting.version}</version>
- <executions>
- <execution>
- <id>default</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- <configuration>
- <projectName>SimpleApp</projectName>
- <outputDirectory>${project.build.directory}</outputDirectory>
- <inputDirectory>${project.build.directory}</inputDirectory>
- <jsonFiles>
- <param>**/cucumber-no-clobber.json</param>
- </jsonFiles>
- <skip>${skipBDD}</skip>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
</build>
<dependencies>
@@ -106,13 +49,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.isis.mavendeps</groupId>
- <artifactId>isis-mavendeps-integspecs</artifactId>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/CucumberTestAbstract.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/CucumberTestAbstract.java
deleted file mode 100644
index 43c9e50..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/CucumberTestAbstract.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 domainapp.webapp.bdd;
-
-import domainapp.webapp.integtests.WebAppIntegTestAbstract;
-import io.cucumber.spring.CucumberContextConfiguration;
-
-/**
- *
- * Provides the App's Spring Context for testing with Cucumber.
- *
- */
-@CucumberContextConfiguration
-public abstract class CucumberTestAbstract extends WebAppIntegTestAbstract {
-
- // any cucumber specific stuff might go here
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/specs/CucumberTest.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/specs/CucumberTest.java
deleted file mode 100644
index 3389412..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/specs/CucumberTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 domainapp.webapp.bdd.specs;
-
-import io.cucumber.junit.platform.engine.Cucumber;
-
-/**
- * Cucumber will scan the package of a class annotated with @Cucumber for feature files.
- * <p>
- * Make sure this class name ends with Test, as Surefire when bundled with Apache Isis
- * filters JUnit tests also by class name.
- */
-@Cucumber
-public class CucumberTest {
-
- // See:
- // https://github.com/cucumber/cucumber-jvm/issues/1149
- // https://github.com/cucumber/cucumber-jvm/tree/master/junit-platform-engine
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/BddStepDefsModule.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/BddStepDefsModule.java
deleted file mode 100644
index ae49680..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/BddStepDefsModule.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package domainapp.webapp.bdd.stepdefs;
-
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-
-import domainapp.modules.simple.SimpleModule;
-
-@Configuration
-@ComponentScan
-public class BddStepDefsModule {
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsContext.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsContext.java
deleted file mode 100644
index 707bc2d..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsContext.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.domain;
-
-import org.springframework.stereotype.Service;
-
-import org.apache.isis.applib.services.wrapper.InvalidException;
-
-import lombok.Data;
-
-import domainapp.modules.simple.dom.so.SimpleObject;
-import io.cucumber.spring.ScenarioScope;
-
-@Service
-@ScenarioScope
-@Data
-public class SimpleObjectsContext {
-
- private SimpleObject simpleObject;
- private String originalName;
- private InvalidException ex;
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsGivenThenStepDef.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsGivenThenStepDef.java
deleted file mode 100644
index 77f3b10..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsGivenThenStepDef.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.domain;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-import org.assertj.core.api.Assertions;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import lombok.val;
-
-import domainapp.modules.simple.dom.so.SimpleObject;
-import domainapp.modules.simple.dom.so.SimpleObjects;
-import domainapp.webapp.bdd.CucumberTestAbstract;
-import io.cucumber.java.en.Given;
-import io.cucumber.java.en.Then;
-
-public class SimpleObjectsGivenThenStepDef extends CucumberTestAbstract {
-
- @Inject protected SimpleObjects simpleObjects;
- @Inject protected SimpleObjectsContext context;
-
- @Given("a simple object")
- public void a_simple_object() {
- val simpleObject = wrap(simpleObjects).listAll().get(0);
- context.setSimpleObject(simpleObject);
- context.setOriginalName(simpleObject.getName());
- }
-
- @Given("^there (?:is|are).* (\\d+) simple object[s]?$")
- public void there_are_N_simple_objects(int n) {
- final List<SimpleObject> list = wrap(simpleObjects).listAll();
- assertThat(list.size(), is(n));
- }
-
- @Then("the name is now {string}")
- public void the_name_is_now(String name) {
- Assertions.assertThat(context.getSimpleObject().getName()).isEqualTo(name);
- }
-
- @Then("the name is unchanged")
- public void the_name_is_unchanged() {
- Assertions.assertThat(context.getSimpleObject().getName()).isEqualTo(context.getOriginalName());
- }
-
- @Then("a warning is raised")
- public void a_warning_is_raised() {
- Assertions.assertThat(context.getEx()).isNotNull();
- }
-
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsWhenStepDef.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsWhenStepDef.java
deleted file mode 100644
index ab7efb4..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/domain/SimpleObjectsWhenStepDef.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.domain;
-
-import java.util.UUID;
-
-import javax.inject.Inject;
-
-import static org.junit.jupiter.api.Assertions.fail;
-
-import org.apache.isis.applib.services.wrapper.InvalidException;
-
-import domainapp.modules.simple.dom.so.SimpleObjects;
-import domainapp.webapp.bdd.CucumberTestAbstract;
-import io.cucumber.java.en.When;
-
-public class SimpleObjectsWhenStepDef extends CucumberTestAbstract {
-
- @Inject protected SimpleObjects simpleObjects;
- @Inject protected SimpleObjectsContext context;
-
- @When("^.*create (?:a|another) .*simple object$")
- public void create_a_simple_object() {
-
- wrap(simpleObjects).create(UUID.randomUUID().toString());
- }
-
- @When("^.*modify the name to '(.*)'")
- public void modify_the_name_to(String newName) {
- wrap(context.getSimpleObject()).updateName(newName);
- }
-
- @When("^.*attempt to change the name to '(.*)'")
- public void attempt_to_change_the_name_to(String newName) {
- try {
- wrap(context.getSimpleObject()).updateName(newName);
- fail();
- } catch(InvalidException ex) {
- this.context.setEx(ex);
- }
- }
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/fixtures/DomainAppDemoStepDef.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/fixtures/DomainAppDemoStepDef.java
deleted file mode 100644
index 91b11fd..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/fixtures/DomainAppDemoStepDef.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.fixtures;
-
-import javax.inject.Inject;
-
-import org.apache.isis.applib.annotation.OrderPrecedence;
-import org.apache.isis.testing.fixtures.applib.fixturescripts.FixtureScripts;
-
-import domainapp.webapp.application.fixture.scenarios.DomainAppDemo;
-
-public class DomainAppDemoStepDef {
-
- @Inject private FixtureScripts fixtureScripts;
-
- @io.cucumber.java.Before(value="@DomainAppDemo", order= OrderPrecedence.MIDPOINT)
- public void runDomainAppDemo() {
-
- fixtureScripts.runFixtureScript(new DomainAppDemo(), null); // <1>
-
- }
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/BootstrapStepDef.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/BootstrapStepDef.java
deleted file mode 100644
index 28e88b9..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/BootstrapStepDef.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.infrastructure;
-
-import org.apache.isis.applib.annotation.OrderPrecedence;
-
-import domainapp.webapp.integtests.WebAppIntegTestAbstract;
-
-public class BootstrapStepDef extends WebAppIntegTestAbstract {
-
- @io.cucumber.java.Before(order= OrderPrecedence.FIRST)
- public void bootstrap() {
- // empty
- }
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/TransactionalStepDef.java b/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/TransactionalStepDef.java
deleted file mode 100644
index 1ff8ec9..0000000
--- a/webapp-tests/src/test/java/domainapp/webapp/bdd/stepdefs/infrastructure/TransactionalStepDef.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package domainapp.webapp.bdd.stepdefs.infrastructure;
-
-import javax.inject.Inject;
-
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.support.TransactionTemplate;
-
-import org.apache.isis.applib.annotation.OrderPrecedence;
-import org.apache.isis.applib.services.user.UserMemento;
-import org.apache.isis.core.interaction.session.InteractionFactory;
-import org.apache.isis.core.security.authentication.standard.SimpleAuthentication;
-
-import lombok.val;
-
-/**
- * equivalent to the Spring @Transactional attribute
- */
-public class TransactionalStepDef {
-
- private Runnable afterScenario;
-
- @io.cucumber.java.Before(order = OrderPrecedence.EARLY)
- public void beforeScenario(){
-
- //open InteractionSession to be closed after scenario (see below)
- interactionFactory.openInteraction(SimpleAuthentication.validOf(UserMemento.ofName("initialization")));
-
- val txTemplate = new TransactionTemplate(txMan);
- val status = txTemplate.getTransactionManager().getTransaction(null);
- afterScenario = () -> {
- txTemplate.getTransactionManager().rollback(status);
- interactionFactory.closeSessionStack();
- };
-
- status.flush();
- }
-
- @io.cucumber.java.After
- public void afterScenario(){
- if(afterScenario==null) {
- return;
- }
- afterScenario.run();
- afterScenario = null;
- }
-
- @Inject private InteractionFactory interactionFactory;
- @Inject private PlatformTransactionManager txMan;
-
-}
diff --git a/webapp-tests/src/test/java/domainapp/webapp/integtests/WebAppIntegTestAbstract.java b/webapp-tests/src/test/java/domainapp/webapp/integtests/WebAppIntegTestAbstract.java
index ee44cbf..695790d 100644
--- a/webapp-tests/src/test/java/domainapp/webapp/integtests/WebAppIntegTestAbstract.java
+++ b/webapp-tests/src/test/java/domainapp/webapp/integtests/WebAppIntegTestAbstract.java
@@ -17,13 +17,11 @@ import org.apache.isis.testing.integtestsupport.applib.IsisIntegrationTestAbstra
import domainapp.modules.simple.SimpleModule;
import domainapp.webapp.application.ApplicationModule;
-import domainapp.webapp.bdd.stepdefs.BddStepDefsModule;
@SpringBootTest(
classes = {
// we use a slightly different configuration compared to the production (AppManifest/webapp)
WebAppIntegTestAbstract.TestApp.class,
- BddStepDefsModule.class,
ApplicationModule.class,
}
)
diff --git a/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_listAllAndCreate.feature b/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_listAllAndCreate.feature
deleted file mode 100644
index ca807b4..0000000
--- a/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_listAllAndCreate.feature
+++ /dev/null
@@ -1,14 +0,0 @@
-Feature: List and Create New Simple Objects
-
- @DomainAppDemo
- Scenario: Existing simple objects can be listed and new ones created
- Given there are initially 10 simple objects
- When I create a new simple object
- Then there are 11 simple objects
-
- Scenario: When there are no objects at all
- Given there are initially 0 simple objects
- When I create a new simple object
- And I create another new simple object
- Then there are 2 simple objects
-
diff --git a/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_updateName.feature b/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_updateName.feature
deleted file mode 100644
index 1b021e2..0000000
--- a/webapp-tests/src/test/resources/domainapp/webapp/bdd/specs/SimpleObjectSpec_updateName.feature
+++ /dev/null
@@ -1,16 +0,0 @@
-Feature: Can modify name (with restrictions)
-
- @DomainAppDemo
- Scenario: Can modify name with most characters
- Given a simple object
- When I modify the name to 'abc'
- Then the name is now 'abc'
-
- @DomainAppDemo
- Scenario: Cannot modify name if has invalid character
- Given a simple object
- When I attempt to change the name to 'abc&'
- Then the name is unchanged
- And a warning is raised
-
-