Fitnesse

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Fitnesse

FitNesse mailing list
Hi,

I am using Spring Framework for UI Testing http://www.javaranch.com/unit-testing.jsp and I am also using Fitnesse with Given, When, Then to call the methods. Problem i am facing with Fitnesse is looks like it doesn't understand @ Autowired annotation may be, because every time i am getting Null pointer exception. I am copying my code here..Please help me to understand how this can be resolved...

I have autowired Environment .

@Autowired
public Environment env;

public boolean RuleManagerSignIn(String http://www.coderanch.com/t/410859/java/java/string-stringbuffer-stringbuilder-performance url, String Testsuite) throws Exception
{
try{
String StrUser = env.getProperty("username");
String StrPassword = env.getProperty("password");
String decryptedPwd = EncryptUtils.decrypt(StrPassword);

OpenUrl(url, Testsuite);
Thread.sleep(1000);
enterUserName(StrUser);
enterPwd(decryptedPwd);
clickSignInButton();
Thread.sleep(6000);
return true;
}
catch(Exception e)
{
e.printStackTrace();
return false;
}
}

java.lang.NullPointerException http://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html 
at com.mastercard.bdd.RuleManager.pageobjects.RuleManagerLoginPage.RuleManagerSignIn(RuleManagerLoginPage.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81)
at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57)
at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38)
at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72)
at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20)
at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135)
at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108)
at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35)
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29)
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49)
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43)
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85)
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84)
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77)
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64)
at fitnesse.slim.SlimServer.serve(SlimServer.java:49)
at fitnesse.slim.SlimService.handle(SlimService.java:154)
at fitnesse.slim.SlimService.acceptOne(SlimService.java:162)
at fitnesse.slim.SlimService.accept(SlimService.java:124)
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76)
at fitnesse.slim.SlimService.main(SlimService.java:56)

 

Reply | Threaded
Open this post in threaded view
|

Re: Fitnesse

FitNesse mailing list
Well, FitNesse does not start Spring unless you instruct it to do so. You
will have to write code to make sure that happens on your own.

Best
Markus

Save our Scrum: http://leanpub.com/saveourscrum
--
Dipl.-Inform. Markus Gaertner
Author of ATDD by Example - A Practical Guide to Acceptance Test-Driven
Development

http://www.shino.de/blog
http://www.mgaertne.de
http://www.it-agile.de
Twitter: @mgaertne

On Tue, Aug 2, 2016 at 10:12 AM, [hidden email] [fitnesse] <
[hidden email]> wrote:

>
>
> Hi,
>
> I am using Spring Framework for UI Testing
> <http://www.javaranch.com/unit-testing.jsp> and I am also using Fitnesse
> with Given, When, Then to call the methods. Problem i am facing with
> Fitnesse is looks like it doesn't understand @ Autowired annotation may be,
> because every time i am getting Null pointer exception. I am copying my
> code here..Please help me to understand how this can be resolved...
>
> I have autowired Environment .
>
> @Autowired
> public Environment env;
>
> public boolean RuleManagerSignIn(String
> <http://www.coderanch.com/t/410859/java/java/string-stringbuffer-stringbuilder-performance> url,
> String Testsuite) throws Exception
> {
> try{
> String StrUser = env.getProperty("username");
> String StrPassword = env.getProperty("password");
> String decryptedPwd = EncryptUtils.decrypt(StrPassword);
>
> OpenUrl(url, Testsuite);
> Thread.sleep(1000);
> enterUserName(StrUser);
> enterPwd(decryptedPwd);
> clickSignInButton();
> Thread.sleep(6000);
> return true;
> }
> catch(Exception e)
> {
> e.printStackTrace();
> return false;
> }
> }
>
> java.lang.NullPointerException
> <http://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html>
>
> at
> com.mastercard.bdd.RuleManager.pageobjects.RuleManagerLoginPage.RuleManagerSignIn(RuleManagerLoginPage.java:67)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at
> fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81)
> at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57)
> at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38)
> at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72)
> at
> fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20)
> at
> fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135)
> at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108)
> at
> fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35)
> at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29)
> at
> fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49)
> at
> fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43)
> at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85)
> at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84)
> at
> fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77)
> at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64)
> at fitnesse.slim.SlimServer.serve(SlimServer.java:49)
> at fitnesse.slim.SlimService.handle(SlimService.java:154)
> at fitnesse.slim.SlimService.acceptOne(SlimService.java:162)
> at fitnesse.slim.SlimService.accept(SlimService.java:124)
> at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76)
> at fitnesse.slim.SlimService.main(SlimService.java:56)
>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Fitnesse

FitNesse mailing list
Indeed,

I would start of by creating a small fixture class that would bootstrap the application (set up a BeanFactory of some sort and start from there).

In this respect, FitNesse is just an alternative entry point to your application. There is no magic involved.

Regards,

Arjan

> On 02 Aug 2016, at 17:58, Markus Gaertner [hidden email] [fitnesse] <[hidden email]> wrote:
>
>
>
> Well, FitNesse does not start Spring unless you instruct it to do so. You will have to write code to make sure that happens on your own.
>
> Best
> Markus
>
> Save our Scrum: http://leanpub.com/saveourscrum
> --
> Dipl.-Inform. Markus Gaertner
> Author of ATDD by Example - A Practical Guide to Acceptance Test-Driven Development
>
> http://www.shino.de/blog
> http://www.mgaertne.de
> http://www.it-agile.de
> Twitter: @mgaertne
>
> On Tue, Aug 2, 2016 at 10:12 AM, [hidden email] [fitnesse] <[hidden email]> wrote:
>
>
> Hi,
>
> I am using Spring Framework for UI Testing and I am also using Fitnesse with Given, When, Then to call the methods. Problem i am facing with Fitnesse is looks like it doesn't understand @ Autowired annotation may be, because every time i am getting Null pointer exception. I am copying my code here..Please help me to understand how this can be resolved...
>
> I have autowired Environment .
>
> @Autowired
> public Environment env;
>
> public boolean RuleManagerSignIn(String url, String Testsuite) throws Exception
> {
> try{
> String StrUser = env.getProperty("username");
> String StrPassword = env.getProperty("password");
> String decryptedPwd = EncryptUtils.decrypt(StrPassword);
>
> OpenUrl(url, Testsuite);
> Thread.sleep(1000);
> enterUserName(StrUser);
> enterPwd(decryptedPwd);
> clickSignInButton();
> Thread.sleep(6000);
> return true;
> }
> catch(Exception e)
> {
> e.printStackTrace();
> return false;
> }
> }
>
> java.lang.NullPointerException
> at com.mastercard.bdd.RuleManager.pageobjects.RuleManagerLoginPage.RuleManagerSignIn(RuleManagerLoginPage.java:67)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:606)
> at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:81)
> at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:57)
> at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:38)
> at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:72)
> at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20)
> at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:135)
> at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:108)
> at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35)
> at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29)
> at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49)
> at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43)
> at fitnesse.slim.ListExecutor.execute(ListExecutor.java:85)
> at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84)
> at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77)
> at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:64)
> at fitnesse.slim.SlimServer.serve(SlimServer.java:49)
> at fitnesse.slim.SlimService.handle(SlimService.java:154)
> at fitnesse.slim.SlimService.acceptOne(SlimService.java:162)
> at fitnesse.slim.SlimService.accept(SlimService.java:124)
> at fitnesse.slim.SlimService.startWithFactory(SlimService.java:76)
> at fitnesse.slim.SlimService.main(SlimService.java:56)
>
>
>
>
>
>
>
>
>