I am trying to create a simple integration test for a Jira plugin that naviagates to a page and asserts if he url is correct. I tried to create the test in two ways:
public class IntegrationTests {
@Rule
public TestRule funcTest = FuncTestRuleChain.forTest(this);
@Inject
private Navigation navigation;
@Inject
private URLAssertions urlAssertions;
@Test
public void navigateAsAdmin() {
navigation.login("admin", "admin");
navigation.gotoPage("/secure/HelloWorldAction.jspa");
urlAssertions.assertCurrentURLEndsWith("/secure/HelloWorldAction.jspa");
}
}
public class IntegrationTests extends BaseJiraFuncTest{
@Inject
private URLAssertions urlAssertions;
@Test
public void navigateAsAdmin() {
navigation.login("admin", "admin");
navigation.gotoPage("/secure/HelloWorldAction.jspa");
urlAssertions.assertCurrentURLEndsWith("/secure/HelloWorldAction.jspa");
}
}
When I try to run them with tthe atlas-integration-test command I get following errrors: (Long version: https://pastebin.com/zv4PEeJr)
com.sun.jersey.api.client.UniformInterfaceException: Client response status: 404
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:688)
at com.sun.jersey.api.client.WebResource.get(WebResource.java:193)
at com.atlassian.jira.functest.framework.backdoor.CacheCheckControl.checkSerialization(CacheCheckControl.java:18)
at com.atlassian.jira.functest.rule.CheckCachesRule.checkCaches(CheckCachesRule.java:44)
at com.atlassian.jira.functest.rule.CheckCachesRule.access$000(CheckCachesRule.java:15)
at com.atlassian.jira.functest.rule.CheckCachesRule$1.evaluate(CheckCachesRule.java:37)
at com.atlassian.jira.functest.rule.LoginAsRule$1.evaluate(LoginAsRule.java:32)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47)
at com.atlassian.jira.functest.rule.WebTesterRule.evaluateLogException(WebTesterRule.java:114)
at com.atlassian.jira.functest.rule.WebTesterRule.access$100(WebTesterRule.java:28)
at com.atlassian.jira.functest.rule.WebTesterRule$1.evaluate(WebTesterRule.java:71)
at com.atlassian.jira.functest.rule.HttpUnitConfigurationRule$1.evaluate(HttpUnitConfigurationRule.java:25)
at com.atlassian.jira.functest.rule.StatementDecorator.evaluate(StatementDecorator.java:22)
at com.atlassian.jira.functest.rule.RestoreDataRule$1.evaluate(RestoreDataRule.java:32)
at com.atlassian.jira.functest.rule.StatementDecorator.evaluate(StatementDecorator.java:22)
at com.atlassian.jira.functest.rule.LogTimeRule$1.evaluate(LogTimeRule.java:52)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at com.atlassian.jira.functest.rule.DisableBigPipeRule$1.evaluate(DisableBigPipeRule.java:44)
at com.atlassian.jira.functest.rule.RestoreDataOnlyOnce$1.evaluate(RestoreDataOnlyOnce.java:31)
at com.atlassian.jira.functest.rule.StatementDecorator.evaluate(StatementDecorator.java:22)
at org.junit.rules.RunRules.evaluate(RunRules.java:18)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Strange is that the error also appears when the body of the test function is empty and when extending the class and using the navigator from the superclass. Is there something I overlooked?
The solution was to add:
@SkipCacheCheck
to the class
I had the same issue and your solution worked perfectly. Thanks a lot for sharing. It saved me hours ! ;-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Put @Named above classname.
@Named
public class IntegrationTests {
@Rule
public TestRule funcTest = FuncTestRuleChain.forTest(this);
@Inject
private Navigation navigation;
@Inject
private URLAssertions urlAssertions;
@Test
public void navigateAsAdmin() {
navigation.login("admin", "admin");
navigation.gotoPage("/secure/HelloWorldAction.jspa");
urlAssertions.assertCurrentURLEndsWith("/secure/HelloWorldAction.jspa");
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the help. I tried it with the @Named annotation but still getting the same error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.