Currently working as a coach in an ATG shop and would like to introduce some form of customer acceptance testing. My weapon of choice is usually Fitnesse but the guys here say it's not possible to drive ATG with Fitnesse. I wonder if anyone else has tried this and, if so, what their experiences were?
Thanks in advance - davep
I'm going to assume you're talking about UI testing, rather than code-level testing; "customer acceptance testing" to me implies UI.
I work on ATG,and i use HtmlUnit and WebDriver to do UI testing, with tests written with JUnit that use those frameworks directly. Our QA guys use Sahi.
I've never used Fitnesse. However, following a quick look at it, i don't see any showstoppers. You'd want to write fixtures that used HtmlUnit or WebDriver (i'd recommend WebDriver) to hit the site and do things in the fixture methods. This would involve three running processes: the Fitnesse server, a process running the fixtures, and then ATG itself. I wouldn't try to run the fixtures inside ATG. Not for UI testing.
Is that the sort of thing you were thinking of?
The recommended way would be to expose an API (e.g. REST+JSON web services) from ATG, and use Fitnesse to drive that.
This has the advantage of, not only being easier to test, but also supporting responsive HTML 5 and native mobile applications.
Depending on your version of ATG, there are various mechanisms in place to expose a component as a REST service. Better yet, though, take a look at Mobile Cube (http://www.deliverycube.com) as a framework that can be used to build a REST API on ATG. (full disclosure, I designed the framework)
In my current project we are using FitNesse to test application, that use ATG.
We use dyn admin injection fixture for preparing test data (for example, to creates a web user).
And than we use steps according to a usual test scenario.
Related
I have gone through fitnesse user guide. But it seems difficult for me to follow since I want to test a web-service.
The problem is as below
I have a request xml file and response xml file.
In request file I have userid and logon id with values .
In response xml file I have location with value.
I need to test that whether I get expected location value , using fitness.
How can I do the test with fitnesse.
Out of the box FitNesse does not test anything. It is really a framework for collaboratively editing and executing tests. To test any sort of software you need to use fixtures. Often people write their own, but you can also use fixtures written by other people.
In the case of testing web services, you can possibly use RestFixture. It is designed to test REST based Web Services. Back when I had to test a TES interface, I chose to write my own using HttpClient and custom parser due to the way our other test fixtures worked.
I don't know anything about it, but you can also look at XmlHttpTest.
Ultimately, you with have to find a fixture that works for you, or build one. This is pretty much true of FitNesse, Cucumber, and most of the similar style tools.
We are planning to make a "large" website for I'd say 5000 up to many more users. We think of putting in lots of real time functionality, where data changes instantly propagate to all connected clients. New frameworks like Meteor and DerbyJS look really promising for this kind of stuff.
Now, I wonder if it is possible to do typical backend stuff like sending (bulk) emails, cleaning up the database, generating pdfs, etc. with those new frameworks. And in a way that is productive and doesn't suck. I also wonder how difficult it is to create complex forms with them. I got used to the convenient Rails view helpers and Ruby gems to handle those kind of things.
Meteor and DerbyJS are both quite new, so I do expect lots of functionality will be added in the near future. However, I also wonder if it might be a good idea to combine those frameworks with a "traditional" Rails app, that serves up certain complex pages which do not need realtime updates. And/or with a Rails or Sinatra app that provides an API to do the heavy backend processing. Those Rails apps could then access the same databases then the Meteor/DerbyJS app. Anyone thinks this is a good idea? Or rather not? Why?
It would be nice if anyone with sufficient experience with those new "single page app realtime" frameworks could comment on this. Where are they heading towards? Will they be able to handle "complete" web apps with authentication and backend processing? Will it be as productive/convenient to program with them as with Rails? Well, I guess no one can know that for sure yet ;-) Well, any thoughts, guesses and ideas are welcome!
For things like sending bulk emails and generating PDFs, Derby let's you simply use normal Node.js modules. npm now has over 10,000 packages, so there are packages for most things you might want to do on the server. Derby doesn't control your server, and it works on top of any normal Express server. You should probably stick with Node.js code as much as possible and not use Rails along with Derby. That is not to say that you can't send messages to a separate Rails app, but since you already have to have a Node.js app running to host Derby, you might as well use it for stuff like this.
To communicate with such server-side code, you can use Derby's model events. We are still exploring how this kind of code works and we don't have a lot of examples, but it is something that we will have a clear story around. We are building an app ourselves that communicates with an email server, so we should have some real experience with this pretty soon.
You can also just use a normal AJAX request or send a message over Socket.IO manually if you don't want to use the Derby model to do this kind of communication. You are free to make your own server-side only routes with Express along with your Derby app routes. We think it is nice to have this kind of flexibility in case there are any use cases that we didn't properly anticipate with the framework.
As far as creating forms goes, Derby has a very powerful templating system, and I am working on making it a lot better still. We are working on a new UI components feature that will make it possible to build libraries of self-contained UI widgets that can simply be dropped into a Derby app while still playing nicely with automatic view-model bindings and data syncing. Once this feature is completed, I think form component libraries will be written rather quickly.
We do expect to include all of the features needed for a normal app, much like Rails does. It won't look like Rails or work like Rails, but it will be similarly feature complete eventually.
For backend tasks (such as sending emails, cleaning up the database, generating pdfs) it's better to use resque or sidekiq
Now, I wonder if it is possible to do typical backend stuff like
sending (bulk) emails, cleaning up the database, generating pdfs, etc.
with those new frameworks. And in a way that is productive and doesn't
suck. I also wonder how difficult it is to create complex forms with
them. I got used to the convenient Rails view helpers and Ruby gems to
handle those kind of things.
Also, my question is not only about background jobs, but also about stuff one can might do during a request, like generating a pdf, or simply rendering complex views with rails helpers or code from gems. –
You're mixing metaphors here - a single page app is just a site where the content is loaded without doing a full page reload, be that a front end in pure js or you could use normal html and pjax.
The kind of things you are describing would be done in a background task regardless of the fornt-end framework you used. But +1 for sidekiq if you're using ruby.
As for notifying all the other users of things that have changed, you can look into using http://pusher.com or http://pubnub.com if you don't want to maintain a websocket server.
In the past couple of days I've been making slow progress adding tests to an existing rails app I've been working on for a little bit.
I'm just trying to figure out how much and what kind of tests (unit, functional, integration) will be enough to save me time debugging and fixing deploys that break existing functionality.
I'm the only one working on this application. It's basically an inventory management database for a small company (~20 employees). I didn't add testing from the beginning because I didn't really see the point but I've have a couple of deploys screw up existing functionality in the last little bit, so I thought it might be a good thing to add.
Do I need to test my models and controllers individually AND perform integration testing? There seem to be developers who believe that you should just integration test and backtrack to figure out what's wrong if you get an error from there.
So far I'm using RSpec + Factory Girl + Shoulda. That made it pretty easy to set up tests for the models.
I'm starting on the controllers now and am more than a little bit lost. I know how to test an individual controller but I don't know if I should just be testing application flow using integration tests as that would test the controllers at the same time.
I use integration tests to test the successful paths and general failure paths, but for the edge cases or more in-depth scenarios then I write model/view/controller tests.
I usually write the tests before writing the functionality in the application but if you want to add tests afterwards then I recommend using something like SimpleCov to see which areas of your application need more testing and slowly build up the test coverage for your application.
Writing tests after the app is already written is going to be tedious. At a minimum you should be testing for integration cases (which will test most controller functions and views), and also model tests separately so that your model calls work as you think they should.
For integration testing I find Capybara easy to use.
As a rule of thumb, most of your tests need to be unit, some functional, few integration.
Rails adheres to this wholeheartedly and you should do the same.
At the minimum you have to have:
A unit test for each of your models, add a test case for each of your validations in each of them, and finally a last one to make the sure the model is saved. If you have stuff like dependant: :destroy, touch: true on related models (has_many, belongs_to), add test cases for them as well.
A functional test for each of your controllers. Test cases for each action. Some actions can have multiple responses (like in case of 422 errors) so add another case to test the error response. If you have a authorization filter, test them as well.
Then you can have an integration test for a typical new user flow. Like
Sign Up -> Create Post -> View it -> logout. Another one is to make sure that unauthorized users cannot access your resources.
And from now, do not commit ANY code without the above mentioned tests.
The best time to plant a tree was 10 years ago, second best time is now, so start testing!
What do I need to learn, where should I go learn it. And why is your recommendation the way to go.
My app has your standard forms, like signin, reset password etc...
The app also has an email ingest library which I want to write automated tests for.
Where should I start? Thanks
There are a lot of testing frameworks for Ruby and/or Rails: RSpec, Cucumber, TestUnit, MiniTest, Shoulda to name but a few. I would recommend trying them out and finding one that best suits your needs. It usually comes down to a personal preference. No framework is always better than another. I have found that some of my projects actually work best when I write tests using a couple of these frameworks depending on what I actually want to test.
As for testing email functionality, I would recommend picking a testing framework, say TestUnit (which is built into Ruby) and going with it. One thing I would make sure to do is to write tests that don't rely on your code actually receiving emails. That way you are testing your implementation and not whether or not emails are actually being sent or received. For example, you could use mocks and stubs to fake actual email data and actual email interactions. You could also write a test class that mimicks an email interface for receiving and sending emails and test that your code can interact with that. Whenever possible try to test only your implementation and not external dependencies.
I've recently started working with RoR for some projects and I quite like the framework - however coming from an ASP.NET background I'm quite fond of the idea of being able to purchase & drop in reusable components/control such as those from telerik, without having to 'reinvent'.
I suppose it would be possible to maybe create my own using partials or plugins or similar, but I'm wondering if there is anything out there already, or perhaps alternatives which could be massaged into place, like javascript widgets etc?
I don't know of any commercial components or "controls", but there's thousands (probably, I haven't counted them) of plugins out there freely available, to do a great many things for you, some of which would probably count as "controls". Unfortunately, there's no one place to go and find them, and the quality is depressingly variable, but there are a number of plugin indexes like http://agilewebdevelopment.com/plugins/ that might help in finding what you want while weeding out the dross.
Ext JS is a great GUI toolkit. I can't say that it entirely fits in with the RoR way of doing things, but if you write your controllers to return JSON it isn't too bad.
One of the big differences between Ruby/Rails and the .Net world is the fact that most of the available plugins are open-source and integrate at the code level. There is an incredible array of plugins for Rails, and it is very straight forward to write your own. Due to the nature of Ruby you can hook into any just about any part of the language and framework, giving you impressive extensibility.
I am not sure how Web Controls work, but it sounds like they are a "black-box" that provides an end-to-end solution for both UI and data-level operations ... ?
Many of the Rails plugins do provide both UI and data aspects. An example would be "restful_authentication" which provides you with both some basic forms for login and user registration as well as an authentication module and a Active-Record model. Again, this operates at a code-level, so will actually push the relevant code into your codebase when you install and "generate" the authentication modules.
As for "widgets", there is no equivalent in Rails, per-se, but there are a number of JavaScript libraries that provide similar functionality. I use and recommend jQuery UI, myself.
Dojo has a widget library which might meet your needs.