JGiven demonstrates an acceptance test going line by line

Can JGiven (with or without w760 support) be used to fetch pre / runtime statements? For example, if we had a fairly typical login acceptance test, i.e.

public class LoginFeatureTest extends SpringScenarioTest<GivenIAmAtTheLoginPage, WhenILogin, ThenTheLoginActionWillBeSuccessful> {

    @Test
    public void my_login_test() {

        given().I_am_a_new_user()
         .and().I_am_at_the_login_page();

         when().I_login_with_username_$_and_password_$("dave", "dave123");

         then().the_home_page_is_visible();

    }

}

      

Can I access the following information?

My Login Test (start)
    Given I am a new user
      and I am at the login page   
     When I login with username dave and password dave123
     Then the home page is visible
My Login Test (end)

      

i.e. I'm looking for: -

  • The method name + script all his given

    , when

    , then

    and and

    the operator is _ (formatted using the formatting JGiven).
  • When each script is run at runtime.
  • When every given

    , when

    , then

    and and

    executed at runtime.
  • When the script method ends.

This will give me the ability to visually show in the user interface (a) exactly what will be executed and (2) the current position at runtime (with duration).

12:00:01.012         [ My Login Test (start) ]
12:00:02.035   23ms     Given I am a new user
12:00:02.051   16ms       and I am at the login page   
   ---->                 When I login with username dave and password dave123
                         Then the home page is visible
                     [ end ]

      

I think Spring AOP can come to the rescue here? Or does JGiven provide anything useful in this code?

+3


source to share


1 answer


There is currently no way to do this. I created an issue for this: https://github.com/TNG/JGiven/issues/328 .



This shouldn't be too difficult to implement, as there is already the concept of a listener inside. If you are still interested, you can suggest an API and integrate the mechanism into JGiven.

0


source







All Articles