JUnit + BDD = COLA Tests
Check out the wiki for documentation and tutorials.
COLA Tests, a JUnit based framework for BDD Tests
JUnit + BDD = COLA Tests
Check out the wiki for documentation and tutorials.
Currently, instrumentation does not have a way to filter out or select the classes of interest to be instrumented. As such, a undesired class might be loaded by the class loader twice, once during instrumentation and a second time during test execution.
Adding a way to select the test classes will prevent such cases.
Resource loading requires the usage of a unix like path separator.
Prefix properties file names with 'cola-tests-'.
Scenario: Should follow maven filter properties
Given a maven filter property (-Dtest or -Dit.test)
When the instrumentation filter is processed (-DcolaTests)
Then the processing will respect maven filters
Feature: Execute classified test groups
Scenario: Should classify scenario
Given a Gherkin scenario tagged with @group
When the tests are executed with -Dcola.group="regex pattern"
Then the matching scenarios will be executed
Introduce filter to prepare Report information from parsed comments.
Add instrumentation mechanism for cola-tests.
Given a gherkin Scenario
When tagged with @skip
Then it should be skipped from execution
Scenario: Should allow for assigned/named parameters
Given a story step
When an annotation has assigned parameters
Then the value should be injected in the step handling method
With the introduction of the IdeEnabler annotation, the need for a default class and method name is no longer required.
Sometimes is useful to call pre and/or post steps without having to explicitly include them in the scenario. This complements "scenario backgrounds" and allows for extra flexibility. E.g.:
@PreSteps({
"Given the details of multiple accounts",
"When the accounts are created" }
@Given("a user")
public fun findAvailableUser() {
user = db.loadFirstUser()
}
Add license header to source classes
Feature: Log failures
Scenario Outline: Should identify failed scenario step
Given a scenario with a problematic <step>
When the scenario is executed
Then the failed <step> will be displayed in error message
Examples:
| step |
| Given |
| When |
| Then |
Currently users have to use the IDE error log (e.g. Eclipse Error Log view) in order to visualize the compile time error.
It would be much nicer to have the compile time errors reported to the console when the junit test is executed.
Consider injecting a test method that will always fail but used to simply report the compile time issues.
Scenario: Should report results
Given a cola test with a report setup
When the test is executed
Then the result will be reported
Prepare poms for release 0.2.0
No error or notification is provided when there's a malformed Examples:
Feature: Malformed examples example
Scenario Outline: Malformed examples
Given A
When B is <foo>
Then C
Examples:
| foo
baa
boo
A correct version would be:
Feature: Examples example
Scenario Outline: Examples
Given A
When B is <foo>
Then C
Examples:
| foo |
| baa |
| boo |
Please provide the option to specify the a directory where feature files are located.
@Features(dir="classpath:features/", features={"feature1", "feature2"})
Add @Depends annotation
Feature: Introduce IDE enabler annotation
Scenario: Should remove method
Given a JUnit test method annotated with @IdeEnabler
When the test is run
Then the method will not be executed
Ensure that tags and comments are parsed from gherkin file.
When a "child" test defined in @dependsOn fails then the parent test must also fail.
Steps should allows for multiple aliases. E.g.:
@Given({"an alcoholic drink", "a beer", "a wine"})
@dependsOn should allow the execution of a single test method as opposed to just the full test class.
Update poms to snapshot 0.2.1-SNAPSHOT
Scenario: Should allow specialized JUnit constructors
Given a JUnit test with a specialized constructor
And a @Feature annotated field
When the test is COLA Tests compiled
Then test methods should be injected
This error can occur when using JUnit Runners like Parameterized that use a specialized constructor to inject parameter values.
Two possible solutions:
Workarounds for current issue:
Hi,
I know this is a big one, and you probably want to focus more on the core functionalities first. But I think it would be very nice to have a better IDE integration (I personally use eclipse). Something basic, like right-clicking on a step in the feature file and being able to jump to the implementation.
I saw there are some plugins in eclipse for other BDD frameworks, maybe it's possible to extend them to add support for Cola annotations?
Anyway I thought i'd open a feature request. I understand if you don't tackle it in the near future.
Cheers
Feature: Exclude tagged scenarios
Scenario: Should exclude tagged scenarios
Given a tagged scenario
When excluded from execution
Then the scenario will not be executed
But all other scenarios will
Scenario: Should exclude tagged feature
Given a tagged feature
When excluded from execution
Then the feature will not be executed
But all other features will
Add config for Travis CI and Appveyor.
Given a gherkin feature
When tagged with @skip
Then it should be skipped from execution
Scenario: Should ignore scenario
Given a gherkin Scenario
When tagged with @ignore
Then it should be skipped from execution
But warn users when skipped
The current name is confusing and the new one is not that much clear either...
Hi,
I'm starting a new project at work which requires ant to build. So I'm using instrumentation to run the JUnit tests, both in ant and in eclipse, which works fine.
However I was surprised to see that the following test did pass given that I don't have the feature file in the project. I wanted to see it fail to make sure the instrumentation was working correctly.
@Features("blabla")
public class BlablaTest extends AbstractBaseColaTest {
@Test
public void something() {
}
@Given("a <beverage>")
public void chooseBeverage(@Projection("beverage") final String beverage) {
}
@When("a google search is performed")
public void performGoogleSearch() {
}
@Then("the <beverage> wikipedia entry will be present")
public void verifyBeverageIsPresentInWikipedia(@Projection("beverage") final String beverage) {
fail("Failed!");
}
}
In a strict BDD test class, I suppose there would not be @test annotations, so it would fail with a message: java.lang.Exception: No runnable methods
But given a test class with a Features annotation, I think the tests should fail if any of the feature file(s) listed cannot be loaded.
On a side-note, this is the first time I'll use it at work, it's a small project where I am the only developer so the context is perfect. I'll do a presentation later this year on BDD to my colleagues and I hope I'll convince more people to use it.
Thanks
In order to keep state between tests it is required to have a way to easily share selected instances.
Extract cola-tests out of cola-maven-plugin and into its own project.
All minor issues regarding 0.1.0 release
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.