Can I generate a regression test suite automatically? - java

We're looking at an upgrade from zimbra 6 to zimbra 7, and we want to avoid regressions in the account lifecycle software we wrote to integrate with it. Since most things are documented by a WSDL file, we were thinking of just using that to test.
What I'm wondering is, is there a way to use an API definition and two target servers to populate a test suite?

Take a look at SoapUI. It is an open source product that can do some automated testing based on a WSDL.

I am using a combination of the below three tools to solve the kind of problem you have mentioned
Model Based Testing
Define graphic model and MBT based code gen using yEd and use GraphWalker to generate the tests dynamically bu walking the model
Spock testing framework + spring-ws
I've used soapUI extensively but it is not very flexible for code gen related tests. It is however super to create the tests once, parameterize them and maintain overtime by checking in the soapui project to version control

Related

How to Build a Data Driven Selenium WebDriver + Java + TestNG Framework

I'm planning to automate some website using Selenium WebDriver + Java + POM(Page Object Model) + TestNG.
I've all other WebPages common for the given website but for each transaction one WebPage which is almost like a form would be different.
So, I've following choices.
Have a Page Object Model (POM) Created for all static common pages and Start creating POMs for the pages which differs in each transaction.
Have a Page Object Model (POM) Created for all static common pages and using some external data source (XML, Excel etc) I can generate the tests for that perticular page.
I'm in favour of second approach here as I don't need to write code again for each new transaction just because there is one page is different?
Any thoughts? or anybody implemented something like this already?
Yes 2nd approach- 'Page Obj model' based is best to keep your code isolated and easily maintainable.
For your test data maintenance I'd suggest you using Cucumber based (BDD driven) framework.
It goes very well with automation FW (POM, Selenium, Java, TestNG/Junit and Maven based) projects.
By using cucumber you need not depend on any other source of test data, i.e. excel or xml, this can easily be maintaned with feature files of cucumber.
Also BDD gives you the main advantage of keeping 'BA-QA-DEV and Management' on same page.
If you dont want to use Cucumber/BDD, then you can use Test NG data provider feature with Excel to achieve better test data management.
If you want to learn Cucumber/BDD-> there are lots of very good video tutorials available online. One of my Fav is here-
https://www.youtube.com/playlist?list=PL6tu16kXT9PpteusHGISu_lHcV6MbBtA6
for web reading:
https://www.lambdatest.com/blog/automation-testing-with-selenium-cucumber-testng/
Happy Testing!
I have worked in similar kind of project. I would suggest to with #1. The reason is that might be possible in future you find difference in web pages, So common function will not be always applicable to each page.
So if you go with #2 as of now then its fine but you gonna end up by following #1 in such cases.
The above answers are mixing the Page object model with a data-driven framework.
Basically in data-driven framework, the data is read from an external file
Well if you want to build a simple pure data-driven framework then it should have
Independent tests
All tests should read data from JSON/XML/YAML/XLS... any source
Properties file having your locators and other settings
You should also create a base class which will have the common reusable functions which can be used in tests
You should make it in such a way that running on grid is easy and by just chaning external flag.. tests should run in GRID
Proper HTML reporting with screenshots, errors, failures should be done
Also watch this video
https://youtu.be/s-W8pw9GnWc

Automated Testing using ReadyAPI (SoapUI NG)

I'm just getting started with ReadyAPI(SoapUI NG) to do automated testing for our Spring based project. So using the ReadyAPI documentation I successfully tested REST URI calls using below steps:
Created a project: File > New Project > Create a Project using REST URI
It creates a project structure like below: REST Project > URI > createAccount < Request 1
In the Request window I added my parameters by using xml/json.
After Running the Request I'm getting my desired response.
I also checked Assertion that also giving desired results.
I did all this using ReadyAPI Documentation
My questions are below:
How to achieve Automated Testing using ReadyAPI(SoapUI NG)?
What features of ReadAPI are generally used? How to use them effectively?
What are the differences between SoapUI NG, LoadUI NG, SoapUI, ReadyAPI? (I thinks these are just different versions, not sure though)
Let me try to answer them to my best of abilities.
How to achieve Automated Testing using ReadyAPI(SoapUI NG)?
Ready API or SoapUI are the automation tools themselves. To manually
test the APIs, there are other tools like swagger. However if
you are planning to automate the flow of your whole project and
planning to use some sort of architecture/framework which will enable
you to do a lot more than just execute the tests at once then you can
try using tools like Jenkins.
What features of ReadAPI are generally used? How to use them
effectively?
One of the most talked about things in Ready API is Data Driven
Testing. If you follow this approach, then you may use test steps like
DataGen, DataSource, DataSink, PropertyTransfer, Groovy Assertions,
Groovy Script Step, JDBC Step. Those are the steps that are used
widely in Ready API Projects.
What are the differences between SoapUI NG, LoadUI NG, SoapUI,
ReadyAPI? (I thinks these are just different versions, not sure
though)
Ready API is a collection of different API testing solutions, like
Performance Testing(LoadUI), Security testing(Secure), Functional
testing (SoapUI). When you install Ready API, you install all the
solutions together. And then you can chose to buy licence for each of
those solutions separately.
Hope that answers your question.

REST-API documentation generation from unittests

I want to automatically document my REST-API. I know, there are many tools for that, but I want to generate the documentation from my unit tests.
The reason for this is, that I want the documentation to mirror, what is tested and what not. Nevertheless the documentation should be as rich as a documentation generated by let's say swagger.
I already found two projects with this approach, doctester and testdoc4j. Both do not satisfy my needs. The resulting documentation does not aggregate the happy path and the error paths.
What tools do you use and can you suggest any good one?
Cheers.
Edit:
There is a difference between documenting the API contract, defined in the interface, and documenting the test scenarios. If my documentation only includes the tested endpoints and pathes, I am able to define my interface and can hand out only the portions, I have tested.
This means I am able to define an interface with let's say ten endpoints. After implementing a basic functionality with corresponding tests, I can release this part with documentation. Not yet stable or implemented endpoints are not included, which prevents the users from using them.
Perhaps you want a BDD framework? Eg:
cucumber
fitnesse
jbehave
I recently did some research about the same topic and decided to use the free version of Miredot because it is the only tool that fulfilled my requirements:
Does not need extra annotations. All information is extracted from JavaDoc
Can handle JAX-RS as well as Spring annotations
Easy maven integration
Miredot generates automatically a HTML based documentation when you run mvn test
Swagger is a beautiful option. It's a project on GitHub, has Maven integration and loads of other options to keep it flexible.
Integration guide: swagger-core wiki
More Information: here
Not sure if you have already found something for this, but Spring RestDocs does exactly what you are asking about here.
https://spring.io/projects/spring-restdocs
Im curious as to other tools you may have run across in other languages too.

About application testing on Java Application

I am doing load test on my server and using JMeter. Do I have any difference choice??
How can I do integration test and How can I do it? Is there any tool?
I know the concept but I dont know how to apply on my project.
My company required me to do a report on load test. Is there any standard on testing? Such as need to use 50 people access and plot the graph of response time?
Sorry I am new to System analyst.
Junit is a framework to support test cases it doesn't provide the tests themselves.
Load testing tends to be specific to the application so you can use JUnit to support that
but you will have to write the tests yourself.
you could look at jMeter or LoadUI

Getting into testing

I am at the stage now where I have a fairly good understanding of programming/development, using Java.
Could anyone tell me the best way for me to start using testing packages? I have looked at Hibernate but not surer where to go with it...
I use Eclipse 3.5 on Mac OS X. Is it a case of writing scripts to test methods? What is unit-testing? etc.
Where do I begin?
Many thanks. Alex
What is Unit Testing
Unit testing is writing code (i.e. test code) that passes known inputs into code under test and then validating the code under test returns expected outputs. It's the most granular testing you can perform on an application. To make it easier, usually a unit testing framework is used. For Java, JUnit is the most popular, but TestNG is also notable.
Getting Started
Unit testing frameworks provide tools for test execution, validation and results reporting. For your setup, Eclipse has built in support for JUnit. Eclipse is able to automatically detect tests, compile tests and code under test, execute tests, and report results within the IDE. Furthermore, failures are reported as clickable stack trace information that loads the corresponding file at the given line number.
Mock Objects
That you're also working with Hibernate, suggests you also investigate a mock object framework as well - such as jMock. Mock objects are usually substituted as part of a code under tests's composition and serve two purposes: (1) returning known outputs and (2) recording they've been called and how so that unit tests can introspect that information as part of validation.
The ability to use Mock objects to make testing easier is predicated on dependency injection. That is other entities that compose the object under test. The idea is decoupling dependencies (e.g. Hibernate) to focus on testing algorithms that manipulate that data you're working with.
Database
However, if you've got code that is not easily refactored, or perhaps you want to validate database code, you can also test Hibernate interaction as well. In that case you want a database in a known state. Three approaches come to mind:
Restoring a database backup at the beginning of each test execution.
Use dbunit, which provides its own mechanisms for maintain state.
Transactional locking with rollback. Wrap the entire case is wrapped with a try{} finally{}, where the latter always rolls back the transaction.
James Shore ("a thought leader in the Agile software development community") has a series of screen casts of him demonstrating Test Driven Development, using Eclipse.
http://jamesshore.com/Blog/Lets-Play/
While there are many ways to start testing, there is no "best" way so there's no point in looking for that as a starting point.
Search the web for a good tutorial on junit and do it. That will be the absolute best way to get started IMO. Don't get sidetracked with code coverage or integrating with Hudson or any of the other tasks that are on the periphery to testing. Focus on writing a handful (or 10) if tests first.
Once you understand the basics you can start looking at other tools to see if they meet your needs any better or worse than junit.
First up: Hibernate is not a testing package.
Now that's out of the way, I'd suggest you take a look at JUnit. Read up on unit testing first so you know what it is (the Wikipedia entry is a good place to start), then try the JUnit cookbook. Write some unit tests for a small piece of your code to see how it works, then move on to bigger chunks.
While you are at it, take a look at other development tools like Cobertura (for finding out how good your test coverage is) and static analysis tools like Findbugs and Checkstyle. These all integrate nicely with Ant and probably Eclipse, too.
If you are interested in improving your coding standards and build systems then I highly recommend using Ant, JUnit, Cobertura, Checkstyle and Findbugs together with a continuous integration server (e.g. Hudson or CruiseControl) and a version control system (e.g. git). With a toolkit like that you can't go wrong.
There are other frameworks out there (TestNG, Mockito etc) so take a look at them, too, and decide which you prefer (EDIT: And which work nicely together. Mockito + JUnit is a good combination.)

Categories

Resources