Library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine.

Overview

J8Spec Build Status

J8Spec is a library that allows tests written in Java to follow the BDD style introduced by RSpec and Jasmine.

More details here: j8spec.github.io.

How to build it

Requirements:

Then run:

$ cd j8spec
$ ./gradlew

That's it.

Comments
  • JUnit version upgrade for CVE-2020-15250

    JUnit version upgrade for CVE-2020-15250

    Hi. It seems like Maven Central now shows that the current version of JUnit that J8Spec is linking against has 1 CVE:

    https://mvnrepository.com/artifact/io.github.j8spec/j8spec/3.0.0 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15250

    The latest 4.x version doesn't seem to have it anymore.

    group: 'junit', name: 'junit', version: '4.13.2'
    

    I'll see if I can send in a PR when possible. Thanks!

    opened by jjzazuet 3
  • Random test execution order and fixed seed options

    Random test execution order and fixed seed options

    One very useful form of keeping tests interdependent is to have execution randomized. This way it could cause test failures when one test setups some information and the other test expect that data to be there.

    I would like to propose the following:

    • [ ] Execute the test order randomly
    • [ ] Have an option to provide a seed and have the same execution order
    opened by bltavares 1
  • "let" constructions

    RSpec provides an interesting feature which allows an expression to have a different value depending on the context where it is being resolved: let and let!.

    describe Subject do
      before do
        do_something_with(key)
      end
    
      context 'when key is value1' do
        let(:key) { 'value1' }
    
        it 'does something' do
          expect(...)
        end
      end
    
      context 'when key is value2' do
        let(:key) { 'value2' }
    
        it 'does something' do
          expect(...)
        end
      end
    end
    

    A possible Java way of doing that using injectors would be:

    public class SubjectTest {{
    
        beforeEach(f -> {
            String key = f.get("key", String.class);
            doSomethingWith(key);
        });
    
        context("when key is value1", () -> {
            let("key", () -> "value1");
    
            it("does something", f -> {
                String key = f.get("key", String.class);
                assertThat(...);
            });
        });
    
        context("when key is value2", () -> {
            let("key", () -> "value2");
    
            it("does something", f -> {
                String key = f.get("key", String.class);
                assertThat(...);
            });
        });
    }}
    

    Another way would be:

    public class SubjectTest {{
    
        Var<String> key = var();
    
        beforeEach(() -> {
            doSomethingWith(var(key));
        });
    
        context("when key is value1", () -> {
            let(key, () -> "value1");
    
            it("does something", () -> {
                String keyValue = var(key);
                assertThat(...);
            });
        });
    
        context("when key is value2", () -> {
            let(key, () -> "value2");
    
            it("does something", () -> {
                String keyValue = var(key);
                assertThat(...);
            });
        });
    }}
    
    opened by tprado 0
  • Example timeout

    Example timeout

    Fails an example if it does not complete under the specified time limit.

    it("completes the operation in time", c -> c.timeout(2, TimeoutUnit.SECONDS), () -> {
        doSomething();
    });
    
    opened by tprado 0
  • Checked Exceptions

    Checked Exceptions

    Replaces Runnable with 2 new functional interfaces: UnsafeBlock and SafeBlock. Since UnsafeBlock is excepted to throw checked exceptions, it will allow the lambda expression to contain code that might throw checked exceptions.

    Closes #40.

    opened by tprado 0
  • Checked exceptions within

    Checked exceptions within "it" blocks

    Sometimes the subject of a test can throw checked exceptions. In these cases the compiler will require the method invocation to be inside a try/catch block:

    it("does something important", () -> {
        ...
        try {
            result = methodThatCouldThrowCheckedExceptions();
        } catch (Exception e) {
            ...
        }
        ...
    });
    

    In order to avoid this situation, the framework could provide a wrapper method to translate checked exceptions into unchecked exceptions:

    it("does something important", () -> {
        ...
        result = unsafe(() -> methodThatCouldThrowCheckedExceptions());
        ...
    });
    

    Reference: Stack Overflow

    opened by tprado 0
Releases(v3.0.1)
  • v3.0.1(Feb 25, 2022)

  • v3.0.0(Mar 21, 2016)

    • random and defined order support via annotations (random is default)
    • timeout
    • after each/all hooks
    • spec can have code that throws checked exceptions
    • JUnit custom description format via system properties j8spec.junit.description.format j8spec.junit.description.separator
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Jul 5, 2015)

    • one time setup, i.e. beforeAll
    • context alias for describe
    • ignore, i.e. xdescribe, xcontext, xit
    • focus, i.e. fdescribe, fcontext, fit
    • j8spec.ci.mode system property
    • multiple beforeEach blocks in the same context
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jun 3, 2015)

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.

That feeling you get when you know you can trust your tests Serenity BDD is a library designed to make writing automated acceptance tests easier, and

Serenity BDD 654 Dec 28, 2022
BDD framework for automation using Selenium Cucumber and TestNg

Selenium Framework with Cucumber BDD framework for automation using Selenium Cucumber and TestNg The framework has following features Modular Design M

null 3 Jan 20, 2022
Framework for Mobile test automation using Appium with Java - BDD

appium-mobile-automation-framework-bdd Mobile automation framework using appium - BDD ?? Quick Start - Appium set up on Windows (Android): Install Jav

Thangaraj 18 Oct 19, 2022
Um projeto simples usando Serenity BDD desenvolvido para testes backend.

?? EM CONSTRUÇÂO ?? Um pouco sobre Serenity e o projeto desenvolvido Serenity_BDD é uma biblioteca de código aberto que visa tornar a ideia de documen

null 10 Aug 30, 2022
Um projeto simples usando Serenity BDD desenvolvido para testes backend.

?? EM CONSTRUÇÂO ?? Um pouco sobre Serenity e o projeto desenvolvido Serenity_BDD é uma biblioteca de código aberto que visa tornar a ideia de documen

null 10 Aug 30, 2022
Master Selenium Framework BDD

Automation Testing | Web | API | Atomic Tests | Cucumber | Java | OOPS | Selenium WebDriver | TestNG | Maven | Cucumber Reports | Java mail API | Design Patterns (Page Object Model, Singleton) | Jenkins

Rajat Verma 38 Dec 14, 2022
PGdP-Tests-WS21/22 is a student-created repository used to share code tests.

PGdP-Tests-WS21-22 PGdP-Tests-WS21/22 is a student-created repository used to share code tests. Important Note: In the near future, most exercises wil

Jonas Ladner 56 Dec 2, 2022
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 9, 2023
make async-await code style available in java just like csharp and es6

JAsync - the async-await pattern of Java 中文版 JAsync implements Async-Await pattern just like es in Java. It allows developers to write asynchronous co

null 124 Dec 26, 2022
Roman Beskrovnyi 248 Dec 21, 2022
🔌 Simple library to manipulate HTTP requests/responses and capture network logs made by the browser using selenium tests without using any proxies

Simple library to manipulate HTTP requests and responses, capture the network logs made by the browser using selenium tests without using any proxies

Sudharsan Selvaraj 29 Oct 23, 2022
Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Testcontainers Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium we

null 6.7k Jan 9, 2023
CodeSheriff is a simple library that helps you in writing JUnit tests that check the quality of your code

CodeSheriff is a simple library that helps you in writing JUnit tests that check the quality of your code. For example, CodeSheriff may fail because you have methods in your code that have more than X lines of code, or that have complexity greater than Y.

Maurício Aniche 62 Feb 10, 2022
Never debug a test again: Detailed failure reports and hassle free assertions for Java tests - Power Asserts for Java

Scott Test Reporter for Maven and Gradle Get extremely detailed failure messages for your tests without assertion libraries, additional configuration

Dávid Csákvári 133 Nov 17, 2022
IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests

IntelliJ IDEA and JUnit: Writing, Finding, and Running Tests ?? Webinar https://blog.jetbrains.com/idea/2021/11/live-stream-recording-intellij-idea-an

Christian Stein 11 Jul 23, 2022
A sample repo to help you handle basic auth for automation test in Java-selenium on LambdaTest. Run your Java Selenium tests on LambdaTest platform.

How to handle basic auth for automation test in Java-selenium on LambdaTest Prerequisites Install and set environment variable for java. Windows - htt

null 12 Jul 13, 2022
A sample repo to help you clear browser cache with Selenium 4 Java on LambdaTest cloud. Run your Java Selenium tests on LambdaTest platform.

How to clear browser cache with Selenium 4 Java on LambdaTest cloud Prerequisites Install and set environment variable for java. Windows - https://www

null 12 Jul 13, 2022
A sample repo to help you run automation test in incognito mode in Java-selenium on LambdaTest. Run your Java Selenium tests on LambdaTest platform.

How to run automation test in incognito mode in Java-selenium on LambdaTest Prerequisites Install and set environment variable for java. Windows - htt

null 12 Jul 13, 2022
A sample repo to help you handle cookies for automation test in Java-selenium on LambdaTest. Run your Java Selenium tests on LambdaTest platform.

How to handle cookies for automation test in Java-selenium on LambdaTest Prerequisites Install and set environment variable for java. Windows - https:

null 13 Jul 13, 2022