Nested testRunners: Can I runClasses separating tests?Unit Testing C CodeHow do you assert that a certain exception is thrown in JUnit 4 tests?What is Unit test, Integration Test, Smoke test, Regression Test?What's the difference between unit, functional, acceptance, and integration tests?Getting no result when run through cucumber. Trying to implement BDDCan't find how to run Cucumber step testsHow to mark Cucumber JUnit step as failed but continueCucumber cannot be resolved to a typeRunListener equivalent in TestNG
Is the Microsoft recommendation to use C# properties applicable to game development?
Is a suspension needed to do wheelies?
Why do aircraft leave cruising altitude long before landing just to circle?
Parse a simple key=value config file in C
What should we do with manuals from the 80s?
What's the point of writing that I know will never be used or read?
What is the purpose/function of this power inductor in parallel?
A+ rating still unsecure by Google Chrome's opinion
How should you gracefully leave a company you helped start?
Vegetarian dishes on Russian trains (European part)
If it isn't [someone's name]!
Units of measurement, especially length, when body parts vary in size among races
Why is the battery jumpered to a resistor in this schematic?
Does Medium Armor's Max dex also put a cap on the negative side?
What was the intention with the Commodore 128?
Reducing contention in thread-safe LruCache
If I am sleeping clutching on to something, how easy is it to steal that item?
global variant of csname…endcsname
programming a recursive formula into Mathematica and find the nth position in the sequence
May the tower use the runway while an emergency aircraft is inbound?
Unconventional examples of mathematical modelling
Meaning and structure of headline "Hair it is: A List of ..."
How to train a replacement without them knowing?
When does The Truman Show take place?
Nested testRunners: Can I runClasses separating tests?
Unit Testing C CodeHow do you assert that a certain exception is thrown in JUnit 4 tests?What is Unit test, Integration Test, Smoke test, Regression Test?What's the difference between unit, functional, acceptance, and integration tests?Getting no result when run through cucumber. Trying to implement BDDCan't find how to run Cucumber step testsHow to mark Cucumber JUnit step as failed but continueCucumber cannot be resolved to a typeRunListener equivalent in TestNG
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
background
I am building a small frame using Cucumber and Junit-quickcheck.
Guidelines require writing the scenarios in cucumber and I want to add the possibility of running property based tests. With quicktheories this works fine, but there are some bugs there and it's maintained by a single person so I'd like to switch to junit-quickcheck.
the question
The code works fine but the two tests are now run as one, and in the cucumber report it's not possible to identify them. So what I'd like is to find a way to write the pbt-tests in the PBT class (not as a class for each test!) and then execute them with cucumber as separate tests.
I suppose there should be a way using the TestClass maybe, but I haven't been able to get that working.
Here is my code that runs, but only as described:
public class Steps implements En
public Scenario scenario;
public Steps()
Given("^I exeute a pbt$", () ->
System.out.println("Lets run the pbt");
Result res = JUnitCore.runClasses(PBT.class);
assertThat(res.getFailures().toString(), res.wasSuccessful(), equalTo(true));
);
}
and:
@RunWith(JUnitQuickcheck.class)
public class PBT
@Property public void concatenationLength(String s1, String s2)
assertEquals("nahh", s1.length() + s2.length(), (s1 + s2).length());
@Property public void reverseTwice(String str)
assertThat(new StringBuilder(str).reverse().reverse().toString(), equalTo(str));
Gives this result:
Running steps.TestRunner
Feature: PBT
Lets run the pbt
@PBT
Scenario: First example # PBT.feature:3
Given I exeute a pbt # Steps.java:40
1 Scenarios (1 passed)
1 Steps (1 passed)
0m0.597s
testing junit cucumber test-runner property-based-testing
add a comment |
background
I am building a small frame using Cucumber and Junit-quickcheck.
Guidelines require writing the scenarios in cucumber and I want to add the possibility of running property based tests. With quicktheories this works fine, but there are some bugs there and it's maintained by a single person so I'd like to switch to junit-quickcheck.
the question
The code works fine but the two tests are now run as one, and in the cucumber report it's not possible to identify them. So what I'd like is to find a way to write the pbt-tests in the PBT class (not as a class for each test!) and then execute them with cucumber as separate tests.
I suppose there should be a way using the TestClass maybe, but I haven't been able to get that working.
Here is my code that runs, but only as described:
public class Steps implements En
public Scenario scenario;
public Steps()
Given("^I exeute a pbt$", () ->
System.out.println("Lets run the pbt");
Result res = JUnitCore.runClasses(PBT.class);
assertThat(res.getFailures().toString(), res.wasSuccessful(), equalTo(true));
);
}
and:
@RunWith(JUnitQuickcheck.class)
public class PBT
@Property public void concatenationLength(String s1, String s2)
assertEquals("nahh", s1.length() + s2.length(), (s1 + s2).length());
@Property public void reverseTwice(String str)
assertThat(new StringBuilder(str).reverse().reverse().toString(), equalTo(str));
Gives this result:
Running steps.TestRunner
Feature: PBT
Lets run the pbt
@PBT
Scenario: First example # PBT.feature:3
Given I exeute a pbt # Steps.java:40
1 Scenarios (1 passed)
1 Steps (1 passed)
0m0.597s
testing junit cucumber test-runner property-based-testing
add a comment |
background
I am building a small frame using Cucumber and Junit-quickcheck.
Guidelines require writing the scenarios in cucumber and I want to add the possibility of running property based tests. With quicktheories this works fine, but there are some bugs there and it's maintained by a single person so I'd like to switch to junit-quickcheck.
the question
The code works fine but the two tests are now run as one, and in the cucumber report it's not possible to identify them. So what I'd like is to find a way to write the pbt-tests in the PBT class (not as a class for each test!) and then execute them with cucumber as separate tests.
I suppose there should be a way using the TestClass maybe, but I haven't been able to get that working.
Here is my code that runs, but only as described:
public class Steps implements En
public Scenario scenario;
public Steps()
Given("^I exeute a pbt$", () ->
System.out.println("Lets run the pbt");
Result res = JUnitCore.runClasses(PBT.class);
assertThat(res.getFailures().toString(), res.wasSuccessful(), equalTo(true));
);
}
and:
@RunWith(JUnitQuickcheck.class)
public class PBT
@Property public void concatenationLength(String s1, String s2)
assertEquals("nahh", s1.length() + s2.length(), (s1 + s2).length());
@Property public void reverseTwice(String str)
assertThat(new StringBuilder(str).reverse().reverse().toString(), equalTo(str));
Gives this result:
Running steps.TestRunner
Feature: PBT
Lets run the pbt
@PBT
Scenario: First example # PBT.feature:3
Given I exeute a pbt # Steps.java:40
1 Scenarios (1 passed)
1 Steps (1 passed)
0m0.597s
testing junit cucumber test-runner property-based-testing
background
I am building a small frame using Cucumber and Junit-quickcheck.
Guidelines require writing the scenarios in cucumber and I want to add the possibility of running property based tests. With quicktheories this works fine, but there are some bugs there and it's maintained by a single person so I'd like to switch to junit-quickcheck.
the question
The code works fine but the two tests are now run as one, and in the cucumber report it's not possible to identify them. So what I'd like is to find a way to write the pbt-tests in the PBT class (not as a class for each test!) and then execute them with cucumber as separate tests.
I suppose there should be a way using the TestClass maybe, but I haven't been able to get that working.
Here is my code that runs, but only as described:
public class Steps implements En
public Scenario scenario;
public Steps()
Given("^I exeute a pbt$", () ->
System.out.println("Lets run the pbt");
Result res = JUnitCore.runClasses(PBT.class);
assertThat(res.getFailures().toString(), res.wasSuccessful(), equalTo(true));
);
}
and:
@RunWith(JUnitQuickcheck.class)
public class PBT
@Property public void concatenationLength(String s1, String s2)
assertEquals("nahh", s1.length() + s2.length(), (s1 + s2).length());
@Property public void reverseTwice(String str)
assertThat(new StringBuilder(str).reverse().reverse().toString(), equalTo(str));
Gives this result:
Running steps.TestRunner
Feature: PBT
Lets run the pbt
@PBT
Scenario: First example # PBT.feature:3
Given I exeute a pbt # Steps.java:40
1 Scenarios (1 passed)
1 Steps (1 passed)
0m0.597s
testing junit cucumber test-runner property-based-testing
testing junit cucumber test-runner property-based-testing
asked Mar 27 at 12:55
ChaiChai
3783 silver badges13 bronze badges
3783 silver badges13 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377741%2fnested-testrunners-can-i-runclasses-separating-tests%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55377741%2fnested-testrunners-can-i-runclasses-separating-tests%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown