Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for regex expression in expected datasets #49

Open
rmpestano opened this issue May 28, 2016 · 1 comment
Open

Support for regex expression in expected datasets #49

rmpestano opened this issue May 28, 2016 · 1 comment

Comments

@rmpestano
Copy link

rmpestano commented May 28, 2016

example:

expected-users-regex.yml

useraccount:
  - id: "regex:\\d+"
    firstname: regex:^Jo.* #John
    lastname: regex:.*ith$ #Smith
    username: regex:.oovd. #doovde
    password: password
    openDate: regex:^(?:[0-9]{2})?[0-9]{2}-[0-3]?[0-9]-[0-3]?[0-9]$

the test:

    @Test
    @ShouldMatchDataSet("expected-users-regex.yml")
    public void should_verify_database_content_using_regex_in_expected_dataset() {
          UserAccount ua = new UserAccount();
          ua.setFirstName("John");
          ua.setUserName("doovde");
          ua.setOpenDate(newDate()); 
          entityManager.persist(ua);
    }

The main motivation is to deal with dynamic data in datasets. Here in the example is the Id which is generated by JPA and openDate.

Although it helps in some cases in most of the cases we have 'controlled' static data in datasets so I think if we add this feature it should come disabled.

What do you think?

@jenskreidler
Copy link

I would appreciate the "regex:" -possibility using Arquillian integration testing !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants