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

Inject CDI scoped beans in unit tests failed #242

Open
larmic opened this Issue Feb 2, 2017 · 17 comments

Comments

Projects
None yet
3 participants
@larmic
Contributor

larmic commented Feb 2, 2017

When I'm trying to inject a @nAmed annotated bean in a @springboot test it is failing with following error

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ...

Is there a support to injects JSF beans in a spring test?

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Feb 4, 2017

Member

hi @larmic

The problem is related to scope of the JSF bean (session, request, view). Take a look at how to test session scope beans with spring boot.

Member

persapiens commented Feb 4, 2017

hi @larmic

The problem is related to scope of the JSF bean (session, request, view). Take a look at how to test session scope beans with spring boot.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Feb 6, 2017

Contributor

Hmm, thinking about it. It feels crappy.

Contributor

larmic commented Feb 6, 2017

Hmm, thinking about it. It feels crappy.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Feb 13, 2017

Contributor

Still thinking about it. Don't find a really nice way...

Contributor

larmic commented Feb 13, 2017

Still thinking about it. Don't find a really nice way...

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Feb 14, 2017

Member

I use Mock strategy to test JSF beans. See JsfIT and JsfMock classes. They were inspired here.

Member

persapiens commented Feb 14, 2017

I use Mock strategy to test JSF beans. See JsfIT and JsfMock classes. They were inspired here.

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Feb 14, 2017

Member

Acceptance test are built with Selenium Webdriver and Page Objects Pattern. However, in this case, I don't need to inject @nAmed bean into test classes.

Member

persapiens commented Feb 14, 2017

Acceptance test are built with Selenium Webdriver and Page Objects Pattern. However, in this case, I don't need to inject @nAmed bean into test classes.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Feb 15, 2017

Contributor

Hmm,

I don't want to create a test using selenium webdriver.

I just want to check my JSF bean is created correctly by Spring. I want so test @PostConstruct is called and all Spring Bean are injected.

Contributor

larmic commented Feb 15, 2017

Hmm,

I don't want to create a test using selenium webdriver.

I just want to check my JSF bean is created correctly by Spring. I want so test @PostConstruct is called and all Spring Bean are injected.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 1, 2017

Contributor

Ok, I still thinking about this point.

We could close this issue here or mark it as "later"?

Contributor

larmic commented Mar 1, 2017

Ok, I still thinking about this point.

We could close this issue here or mark it as "later"?

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 2, 2017

Contributor

Ok, we've found a solution for that. I will create a demo within the next days.

Contributor

larmic commented Mar 2, 2017

Ok, we've found a solution for that. I will create a demo within the next days.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 3, 2017

Contributor

https://github.com/larmic/joinfaces-bean-test

this code should be cleaned up and better documented. Is it a good add on for joinfaces?

Contributor

larmic commented Mar 3, 2017

https://github.com/larmic/joinfaces-bean-test

this code should be cleaned up and better documented. Is it a good add on for joinfaces?

@persapiens persapiens added the feature label May 7, 2017

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens May 7, 2017

Member

hi @larmic ,

Of course it seems a great improvement for testing.

I've just linked it at several joinfaces wiki pages.

Huge thanks.

Member

persapiens commented May 7, 2017

hi @larmic ,

Of course it seems a great improvement for testing.

I've just linked it at several joinfaces wiki pages.

Huge thanks.

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Sep 14, 2017

Member

hi @larmic ,

Is it possible to integrate joinfaces-bean-test code into joinfaces? We created joinfaces-test sub module to include test facility classes to JSF and spring boot.
Is there any license restriction? Would you mind becoming joinfaces collaborator?

I look forward your answer.

Member

persapiens commented Sep 14, 2017

hi @larmic ,

Is it possible to integrate joinfaces-bean-test code into joinfaces? We created joinfaces-test sub module to include test facility classes to JSF and spring boot.
Is there any license restriction? Would you mind becoming joinfaces collaborator?

I look forward your answer.

@larsgrefer

This comment has been minimized.

Show comment
Hide comment
@larsgrefer

larsgrefer Mar 7, 2018

Collaborator

@persapiens @larmic Should we close this issue?

Collaborator

larsgrefer commented Mar 7, 2018

@persapiens @larmic Should we close this issue?

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Mar 8, 2018

Member

I think we can close it because @larmic is improving JoinFaces Bean Test regularly.

Member

persapiens commented Mar 8, 2018

I think we can close it because @larmic is improving JoinFaces Bean Test regularly.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 9, 2018

Contributor

Hi, I already had the idea to integrate this. I have unfortunately found too little time. So it is supposed to go there?

We can leave it with me or simply build a JoinFaces test as a separate module (or as part of joinfaces-test) under JoinFaces.
If you provide that to me, I would convict the code.

(and I have to apologize. I missed the comment from the 14th of september)

Contributor

larmic commented Mar 9, 2018

Hi, I already had the idea to integrate this. I have unfortunately found too little time. So it is supposed to go there?

We can leave it with me or simply build a JoinFaces test as a separate module (or as part of joinfaces-test) under JoinFaces.
If you provide that to me, I would convict the code.

(and I have to apologize. I missed the comment from the 14th of september)

@persapiens

This comment has been minimized.

Show comment
Hide comment
@persapiens

persapiens Mar 16, 2018

Member

Hi @larmic, welcome to our team.

You can stay with JoinFaces Bean Test. No problems.

However, if you integrate it into JoinFaces, you could merge into joinfaces-test module. It would ease writing joinfaces test cases internally too.

Member

persapiens commented Mar 16, 2018

Hi @larmic, welcome to our team.

You can stay with JoinFaces Bean Test. No problems.

However, if you integrate it into JoinFaces, you could merge into joinfaces-test module. It would ease writing joinfaces test cases internally too.

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 22, 2018

Contributor

Ok, I will merge it into joinfaces-test within the next days and update documentation

Contributor

larmic commented Mar 22, 2018

Ok, I will merge it into joinfaces-test within the next days and update documentation

@larmic

This comment has been minimized.

Show comment
Hide comment
@larmic

larmic Mar 26, 2018

Contributor

An integration in joinfaces-test causes me difficulties. The CDI beans are generated too early and then mock injection stops working properly.
My project on https://github.com/larmic/joinfaces-bean-test is running with JoinFaces 3.0.2.
Maybe I have more time over Easter to look at the integration.

Contributor

larmic commented Mar 26, 2018

An integration in joinfaces-test causes me difficulties. The CDI beans are generated too early and then mock injection stops working properly.
My project on https://github.com/larmic/joinfaces-bean-test is running with JoinFaces 3.0.2.
Maybe I have more time over Easter to look at the integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment