Which design patterns should we use with Selenium WebDriver? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Page Object Pattern is obvious. But what I can do more to build better automated test cases for web application?

I may not be able to talk about any standard pattern, but here are a few things that I consider:
Make good use of Test Execution frameworks. I use TestNG.
I create a base file which makes use of most of the TestNG annotations for Setting and Tearing up.
Separate your Re-usable functions and call it wherever needed. I generally add these in the base class.
I personally prefer keeping locators too in the base file if they are too complicated. This would help you to change the locator from one place and get reflected for all. In this case, do follow a good naming convention.
Use collections wherever possible.
You can use something like ReportNG for more user friendly reports.
Make more use of implicit waits and avoid using JavascriptExecutors.
Copy the Drivers and libraries within the project folders for better mobility and less external dependencies.
Adding selenium WD javadoc to your project will be of some help.
We also make sure we have a screenshot for failed test case by over-riding the onTestFailure method.
Rest all are simple coding basics for cleaner and easy to understand code that I believe you'll be following anyway.
Hope this was of some help. Will add more points if I'm able to recall. Also, please let me know if you need more details for any of these things.

Related

Need design guidance to develope java spring hibernate web application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create java web based application using Spring-Hibernate. I know its not difficult to implement the functionality, but i need some help/guidance from the architecture perspective. Can any one suggest me the best design which will cover interfaces,design patterns etc.
Also need which version should i use of spring and hibernate.
The best way to start implementing a web application using the technologies you mentioned is to follow a tutorial from the large variety of tutorials you can find using google.
Another good option is to find a skeleton for an application that someone has created and shared in a source code sharing service like github or bitbucket (check the licenses also). You can check-out the code and have an initial working example you can work on and expand.
If something does not work during these attempts, then please come back here, search if your question is already asked by someone else, and if not place your question with specific code snippets and error messages you may get.
If everything works well and you need advices on different ways to improve performance, your architecture and the software patterns, then come back here also with a specific question, or in some cases you will find codereview more suitable for this kind of questions.
Good luck!

What is the best approach to improve on Selenium webdriver project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
What i have done :
Created few projects using Java/ Selenium Webdriver/ TestNG using eclipse
Getting the TestNG test results in an XML/ HTML formats and looking for failures etc.,
What i can look for hereafter,
Do i need to use Maven(or likely tools), for managing projects, and why?
Do i need to look for Jenkins type of tools(But i know it depends on context, still if there will be any real usability with selenium webdriver)
Do i need to look for reporting tools(such as surefire) which is well equiped?
Or is it ok to continue with what i'm doing for a not so complicated project?
I know this qustion may be really broad, but i don't find anything solid to look after.
Appreciate your help, Thanks!
I think the world has agreed that Continuous Integration is good which is pretty rare for any technology.
I would definitely suggest setting up jenkins or equivalent and adding the maven configuration to be able to get your project to run and store results there. This may end up being more work because ideally you want to get the project you are testing to be built on check in and have its unit tests etc to run and then get deployed so you can run your selenium tests.
It shouldnt take too long to do depending on the ease of deployment of the app your testing, but even just having your tests being able to be kicked off automatically and its results stored will be handy and give you a real visibility boost of your tests.

Understanding the code process of Ccleaner [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How does a Register cleaner tool works if you would analyze the code ?
I'm not asking for specific code here...I'm just wondering the code for a tool like Ccleaner for instance is working, roughly explained.
The reason why I ask this is because I want to create an class diagram about the Ccleaner tool.
But ofcourse for Ccleaner specificly you would need the source code..and we all know no normal has acces to the source code of ccleaner
But if anyone know's any registery and pc cleaner tool is getting to it to clean up the mess on your computer and how it's cleaning up your registery...it would help me big time to create an class diagram.
Thanx
It depends much on how you design your application (because this looks like a design exercise more than anything).
First I would recommend you to list down your requirements. Saying "like ccleaner" is just way too broad. Just come up with a list of functionality you need your system to achieve and try to break down such list into smaller responsibilities. Also come up with a list of candidate objects and try to distribute your responsibilities in between those objects, after that you can start thinking in your structure and how to organize them (composition, association, inheritance relationships). Good objects are not anemic (0 responsibily) nor godly (a tons of stuff to do)
That roughly is a way to do it. There is no perfect design nor "a single class diagram" that might answer this question.

How can i see every method called in a Java Application? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is there a way to get textual output of every method invoked by the JVM at runtime?
If you are using Eclipse you can right click the method and choose "Open call hierarchy"
I am not very sure if you are looking for ASM, it is used for analyzing the bytecodes
ASM is an all purpose Java bytecode manipulation and analysis
framework. It can be used to modify existing classes or dynamically
generate classes, directly in binary form. Provided common
transformations and analysis algorithms allow to easily assemble
custom complex transformations and code analysis tools.
ASM offer similar functionality as other bytecode frameworks, but it
is focused on simplicity of use and performance. Because it was
designed and implemented to be as small and as fast as possible, it
makes it very attractive for using in dynamic systems*.
My suggestion is please use debugger to see the whole process is being done.
You can write a CGLIB proxy to trace your methods.
You should use Java profiler tool. There are two well-known profilers - YourKit Java Profiler and JProfiler.
I prefer first one, but you can try both and make your choice.

What's the best way to write a command-line app in Java? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Okay, I know there are probably a dozen ways to solve this, but I am looking for either a skeleton app or some sort of tutorial that will explain the best way to write a framework for creating Java-based command-line tools. If my program requires a lot of switches/options/etc., what's the best way to handle all of them?
How do you decide which stuff should be placed into an options/settings file, and which stuff gets put on the command line? Any sort of sample code would be great, that way I can put my time more towards the central focus of my app rather than the command-line plumbing.
I also suggest looking at JCommander (http://jcommander.org/), written by the author of TestNG. I have used it successfully in many command line applications.
How do you decide which stuff should be placed into an options/settings file, and which stuff gets put on the command line?
There's no such dilemma, many things are useful in both places. With the settings file you let the user define defaults and with the command line you let the user override them. Of course, there are cases when only one of the two makes sense, but I'd take providing both as the starting point.
The previous answer seems to cover what you want to know for writing the app. As for your question about what should go in config files and what should be command line options I would recommend this. If the option is something that is likely to have the same value most of the time put it in a config. If its something that changes frequently make it an option, but remember options SHOULD be optional, try not to create a program that someone has to type in allot of required stuff to make it do it's base function.

Categories