on 07-11-2014 1:46 PM
java.lang.IllegalStateException: no tenant active. if you do not want to use tenants, call Registry.activateMasterTenant() to assure the Master tenant is active.
This is what I get from the sample Junit TestCase below when startetd in ee. In this test I'm using an external Oracle database running on our integration server.
Can you please provide some info on how to do unit / integration testing in eclise or intellij. Thanks.
public class CustomerRegistrationIntegrationTest extends HybrisJUnit4TransactionalTest {
@Before
public void setUp() {Registry.activateMasterTenant(); }
@After
public void tearDown(){}
/**
* This is a sample test method.
*/
@Test
public void testMe() {
final boolean testTrue = true;
assertTrue("true is not true", testTrue);
}
}
I tried Anshuls idea yesterday but it went horribly wrong. We had to completely re-build our integration database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Konrad Thanks, I guess the OP wanted to reduce overall start up time. So far, my tests don't even run.
@Anshul I like your idea. Their might a be problem though with loosing our test data. What we do is we first create a customized dump based on our production environment which then gets re-imported into integration. So, maybe there is a way to integrate the junit tenant activation process into the current work flow without loosing any data.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We had similar errors for JUNITS when initiated from Ee, but JUNITS used to work when started from hMC (http://localhost:9001/test). Also review the exceptions in log file, it sometimes goes beyond "No tenant active" issue. For initiating JUNITs from ee, please ensure that you are including all required extensions configured in localextensions.xml file in the project selection box for test configuration. Ensure that the JUNIT tenant is initialized either through hMC or ant target invocation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have cleaned all the extensions which are imported into ee and after that i ran the Junit testcase directly from ee it has worked actually for me. Just make sure that you have initialized your database by activating junit tenent. There is one more way by which test case can be executed open the URL **http://localhost:9001/test** select your test file and then click the run button.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's a discussion that might help:
https://wiki.hybris.com/display/forum/How+to+keep+the+junit+tenant+running
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.