0

I am working two projects which has both same functionalities. And I separated out test cases to the other project. So I added these projects as dependencies. Objects will instantiate based on Spring beans logic.

How to run maven project two times in single execution request along with this, I want to instantiate bean based on maven config.

Thanks, Shiva

Shiva
  • 1
  • 1

1 Answers1

0

I know it makes perfect sense in your head, but we need a better explanation on what it is you are looking to do. The question in the current state is confusing at best.

In case you'd like to instantiate some beans while running test suite A, and other beans when running test suite B, you have options:

  • Use different test configs for suites: test-suite-a.cong & test-suite-b.conf
  • Use Spring Profiles and run your maven tasks setting an appropriate profile

  • I am working two projects which has both same functionalities. And I separated out test cases to the other project.

Sounds a bit strange. If these two projects are the same, combine them into a single project. If they are different, use different src/test/... for each.

tolitius
  • 22,149
  • 6
  • 70
  • 81
  • Two projects will solve same problem. But different type of implementation. Initially I added test cases at both the projects. And the problem that I was facing, when i need to change in test cases i need to modify at both the project test case code. To avoid that I decided to move in to the separate project. And added the dependencies to the new test case execution projct. – Shiva Mar 15 '12 at 16:57
  • if you just want to create different (set of) beans that depend on who/when/what runs it, you can use Spring Profiles ([example](http://stackoverflow.com/questions/9435246/spring-injecting-different-properties-file-according-to-profile/9440209#9440209)), or SpEL / Property Based solutions ([example](http://stackoverflow.com/questions/9470551/spring-property-substitution-for-test-and-production/9471696#9471696)). Then you can control the execution by Maven setting system/env variables. – tolitius Mar 19 '12 at 14:35