How can we use dependency functionality that is present in jasmine - jasmine

In jasmine suite , if we have 10 specs , how can we arrange dependeny specs such that if any dependency specs are failed the jasmine should not execute other specs which has to be executed.
In testNG library which is used for java unit testing where we are using dependency groups or methods attribute on an #test annotation

Related

How do I run one specific spec in Spock? Using it with GEB and gradle

I'm creating a fairly large test suite using gradle, geb, and spock in conjunction. Gradle is obviously building and kicking off geb and spock, but I think that spock is where I can control and specify which Spec to run.
I'm building this based off of this starter.
https://github.com/AutomationSchool/geb-and-spock-automation-examples
How can I set this to run just one Spec?
Gradle's Test task takes a tests option. The supported patterns are documented in the javadoc for TestFilter. So if you want to run spec class called MySpecToRun in the project you linked to then you can do it this way:
./gradlew chromeTest --tests=MySpecToRun

Is it a fallacy to have a 'tester goal'?

Well, I would like to have a maven goal execute-custom-tests inside my custom-maven-plugin that consists of running test methods (This tests are not unit tests). Something similar to test goal of soapui-pro-maven-plugin, for example.
Why? Basically the main objectives of the plugin are testing stuff (not unit testing) and the tests in src/test are for unit testing, right?
Being more specific I was thinking about something like this:
#Mojo (name = "run-custom-tests", LifecyclePhase.TEST)
public class TesterMojo extends AbstractMojo {
#Parameter(property = "someParameter")
private String someParameter;
// [...] parameters for test configuration
#Override
public void execute() throws MojoExecutionException, MojoFailureException {
// Piece of code that executes a set of custom tests which procedure I specified.
}
}
When test fail, I would like them to be marked as failed tests not as failed executions. What's the right thing to do here? Show me the light, please.
Maven conventions support two types of testing out of the box: unit tests (via maven-surefire-plugin) and integration tests (via maven-failsafe-plugin).
By default, maven-surefire-plugin only looks for the following files with unit tests:
**/Test*.java
**/*Test.java
**/*TestCase.java
Similarly, default includes for integration tests run by maven-failsafe-plugin are the following:
**/IT*.java
**/*IT.java
**/*ITCase.java
So, as you can see, Maven lets each plugin figure out which tests it should care about. So it's perfectly fine for src/test/java to contain different types of tests, not just unit tests.
Different folder
You can put tests in a different folder too. One example would be if you have non-Java tests, since then src/test/java location doesn't make sense. Standard Maven plugins get project model from Maven to figure out the src/test/java location and some 3rd party plugins use the same mechanism. Depending on the plugin you use, you might want to check out its configuration or use maven-build-helper-plugin to add-test-source in order for some plugins to pick up another test folder automatically.
Different tests on demand
From the Maven perspective the core difference between unit tests and integration tests is the additional requirements for the later: they often need to have your project already packaged and they often need additional setup or teardown. But you yourself can set up multiple test goals during both test and integration-test phases. All major test frameworks support specifying which test suite should be run when (e.g., via groups). If your framework doesn't, you can still use plugin includes/excludes. It is a standard practice to combine this with Maven profiles in order to only run smoke tests by default (during development) and to run full tests on CI environment. You can use the same approach to enable anyone (a tester?) to run extra tests on demand, e.g., to run extra heavy tests when certain important part of the code has changed.

When I use JMockit 1.18 console says method should not have parameters

I was using JMockit 1.13 in my maven project. I have passed some arguments to my test case to mock some classes for the test case. Test cases were running fine. But now I updated to JMockit 1.18, Now I see error on console when I run test case like this method should not have parameters.
That error message indicates that JMockit was not initialized at the beginning of the test run, so the JUnit integration remained inactive. You will need to move the jmockit dependency before junit in the test classpath, or annotate your test classes with #RunWith(JMockit.class).

Using multiple runner annotation in test class for spring-boot and testrail

I have to link my tests with testrail and for that I have to use the testrailrunner. But if I exclude the springjunit runner then my tests fail on starting the service and its not possible to use both the runners
What's a workaround for this so that my tests get inititalize with the service beans and still logg in test rail?
There is no way to have multiple test runners on single unit test, but use can use JUnit rules instead.
Spring introduces support for #Rules in 4.2 (4.2 RC1 is the latest version): https://jira.spring.io/browse/SPR-7731
I am not familiar with testrailrunner, but if it has no support for JUnit rules, you can:
implement custom rule for handling testrail
implement your own runner that handles functionality from SpringJUnit4ClassRunner and testrailrunner
implement custom rule for injecting Spring context - there are some implementations that are supposed to work with current Spring version: http://www.alexecollins.com/tutorial-junit-rule/ (I haven't tested it).

Support for 'configfailurepolicy' for TestNG in gradle

Hi is there plan to add support for 'configfailurepolicy' property (http://testng.org/doc/documentation-m...) for TestNG in gradle ?
It's really inconvenient that if some test fails in Before* phase, all other tests are skipped (even unrelated tests in different classes)

Resources