What language can be used to automate web test? - automated-tests

I'm working on a Web Service which is associated with a form that requires inputs from user. The problem is the fields are quite large, approximately 200 fields need to be filled in. I would like to ask what language would serve best in this case, in term of automating inputs.
I tried Ruby with Watir, but it doesn't work as expected when dealing with iframe. So I'm looking for an alternative solution. Any feedback or suggestion would be greatly appreciated. My WS is developed using ASP.NET and Java Script.
Thanks,
Chan

Selenium may provide the functionality you're looking for. It is a testing framework that supports recording tests, so writing scripts is optional. It does however provide scripting functionality in a variety of languages, including Java, C#, Ruby, Python and more.

Have you tried WatiN? It is an open source automated test framework for Web application. And it support C# and other managed languages.

Related

Getting started with databases

I am currently a front end developer. I know HTML and CSS pretty well, I'm OK with jQuery and know some Vanilla JS. I have an idea for a website I want to create where I will be storing data for products (data that I will be grabbing from various websites around the web). It's basically a help me choose application where the user will go through some steps and be given some choices based on their selections. This site is nothing new, but it's more for learning purposes/portfolio work.
Most of my co-workers use ASP.NET and I've seen that you can setup a website like this using ASP.NET and the provided server controls along with C#, however, I want to take another route that allows me to do the same thing NOT using ASP.NET (C# is OK and preferred if that is possible) in that I can grab data, store data, and bind data to my page.
In addition to this, I would like to do this on the Mac.
Here's a list of things I have looked at:
MongoDB (I was really confused by the setup and didn't read anywhere that this would definitely be the solution).
AngularJS
EmberJS
BackboneJS
Several other JS frameworks
Ruby on Rails
Note about the above: Some of the above might be the solution, but I don't want to start spending time learning them only to realize a week in that this is not going to help me get to my goal.
If this post would be better suited for another stack site please let me know. Thank you.
To create a basic website with a persistence you'll need to deal with three parts the front-end (client), back-end (server) and the persistence (database). Of the things that you've listed Angular, Ember and Backbone are all front-end frameworks. They each have their own way of approaching the issue but they all work in the client facing part of the project so views, interaction and dispatching data to the backend. Rails is the only thing that you've listed that's a back-end framework, another option for the back-end if you're more familiar with JS might be Node and Express. Node allows you to build a server in JS and Express is one of the more popular Node frameworks. That section will be responsible for getting the calls for data and calls with data from the front-end and dispatching the appropriate response. Rails typically works with with a SQL database like MySQL or PostGres out of the box because Rails' active record is meant to work with SQL. Mongo is a NoSQL database and I think people are getting it working with Rails but I don't know that it's highly common. Mongo's shell is pretty much javascript and it stores data as JSON (not technically but close enough) so it's been a comfortable choice for JS developers learning back-end. Either Rails or Node can get a server up and running locally on your machine so you can work with the full architecture. So what it comes down to really is picking one of each from those sections and making them play nicely together. For your purposes I would think that the way to go would be either a basic Rails app (probably with MySQL) and using jQuery ajax calls to manage some calls from the front-end or building something with the so-called MEAN stack (Mongo, Express, Angular, Node) which is all JS and using Angulars built in http functionality to handle those calls. Hope this at least narrowed the field of research a bit. Really thats a pretty open question and there are a lot of options.
What is your webhosting site? I suggestPhpmyadmin Or Mysqldatabase You can create tables and strings where you can put the websites you wanna "grab" data from and put a little javascript in there to tell your website if blahblahnlah =blahblahblah then get id="website1"
Some clarifications:
At first, you need to distinguish between a server side language (used to program the functionality) and a database (used to store data).
C# is a language of the .net framework. Regarding websites, there's no C# without ASP.net.
There are two major groups for realizing back end solutions: PHP (market share ~ 40%) and ASP (~ 25%). PHP is a programming language, ASP.net incorporates several programming languages (mainly C# and VB.net).
Both worlds are able to connect to databases: For PHP, this is mainly MySQL, for ASP.net it is mostly Microsoft SQL server.

asp.net c# sample code library of comon tasks/ boiler plate code

anyone use/ know of any library or website with code snippets or samples with many of the mundane boilerplate code and/ or functions like data access, data scrubbing, recursive routines...
preferably c# since most of .net in the real world is c#. VB is ok too.
There is a lot of good stuff (specifically for 'Data Access') in the Microsoft Patterns & Practices Enterprise Library here. For scrubbing HTML and input from websites there's the Microsoft Web Protection Library (AntiXSS) here.
There is a bunch of snippets here (CSharp Online).
Though, the best chance is to simply google/bing for the task you are trying to achieve - there are so many blogs and other sources of data (MSDN) out there. It's my first port of call.

What is a good asp.net (NOT MVC!) reference application for a beginner?

I'm looking for a good asp.net webforms reference application.
We have some developers with VB6 experience, but no web application experience. I'd like to provide them with a couple of example apps that make use of a few simple forms, some user controls, db access, etc. An application that made use of a separate project for classes would be a nice bonus.
There seem to be a lot of very simple examples/tutorials for given features, but I can't find a good reference app that covers all of the above-mentioned topics.
Any suggestions?
I would recommend the ASP.NET starter kits here on the asp.net site. They are pretty diverse. My suggestion would be to actually try the hosted versions until you find one that suits the features you're trying to demonstrate. BeerHouse is a great start.
This one looks pretty interesting. It's a shameless plug for the Infragistics controls, but it looks like they're doing some non-trivial things:
The reference application shows the
use of web services, client side java
scripting, XML data binding and other
real world code samples.
http://devcenter.infragistics.com/RefApps/Expense/Expense.aspx
http://www.asp.net/community/projects/
Starter kits are a good place to look...

What should I be aware of when moving from asp.net to python for web development?

I'm thinking about converting an app from Asp.net to python. I would like to know: what are the key comparisons to be aware of when moving a asp.net app to python(insert framework)?
Does python have user controls? Master pages?
First, Python is a language, while ASP.NET is a web framework. In fact, you can code ASP.NET applications using IronPython.
If you want to leave ASP.NET behind and go with the Python "stack," then you can choose from several different web application frameworks, including Django and Zope.
Zope, for example, offers a pluggable architecture where you can "add on" things like wikis, blogs, and so on. It also has page templates, which are somewhat similar to the ASP.NET master page.
I second the note by Out Into Space on how python is a language versus a web framework; it's an important observation that underlies pretty much everything you will experience in moving from ASP.NET to Python.
On a similar note, you will also find that the differences in language style and developer community between C#/VB.NET and Python influence the basic approach to developing web frameworks. This would be the same whether you were moving from web frameworks written in java, php, ruby, perl or any other language for that matter.
The old "when you have a hammer, everything looks like a nail" adage really shows in the basic design of the frameworks :-) Because of this, though, you will find yourself with a few paradigm shifts to make when you substitute that hammer for a screwdriver.
For example, Python web frameworks rely much less on declarative configuration than ASP.NET. Django, for example, has only a single config file that really has only a couple dozen lines (once you strip out the comments :-) ). Similarly, URL configuration and the page lifecycle are quite compact compared to ASP.NET, while being just as powerful. There's more "convention" over configuration (though much less so that Rails), and heavy use of the fact that modules in Python are top-level objects in the language... not everything has to be a class. This cuts down on the amount of code involved, and makes the application flow highly readable.
As Out Into Space mentioned, zope's page templates are "somewhat" similar to ASP.NET master page, but not exactly. Django also offers page templates that inherit from each other, and they work very well, but not if you're trying to use them like an ASP.NET template.
There also isn't a tradition of user controls in Python web frameworks a la .NET. The configuration machinery, request/response process indirection, handler complexity, and code-library size is just not part of the feel that python developers have for their toolset.
We all argue that you can build the same web application, with probably less code, and more easily debuggable/maintainable using pythonic-tools :-) The main benefit here being that you also get to take advantage of the python language, and a pythonic framework, which is what makes python developers happy to go to work in the morning. YMMV, of course.
All of which to say, you'll find you can do everything you've always done, just differently. Whether or not the differences please or frustrate you will determine if a python web framework is the right tool for you in the long run.
Most frameworks for python has a 'templating' engine which provide similar functionality of ASP.NET's Master pages and User Controls. :)
Thanks for the replies Out Of Space and Jarret Hardie

Testing the UI in an Asp.net Page?

What's the best way to automate testing the UI in an Asp.net Page?
Watir or Watin are a great place to start.
More info here
Quite loosely defined question so a good answer is almost impossible.
Would dare to suggest that using Selenium might help with automating the task.
If you are the only coder on a project, I would suggest testing it by hand. That said, you will likely suffer from coder myopathy. Since you wrote the code and know what it is supposed to do, you may subconsciously avoid actions that will break it.
I have worked with different automation methods and they tend to be fairly heavy. In other words, you will find yourself working on updating your tests more often than you would like. In my opinion, automated testing only becomes necessary when you have more than one developer on a project and they are not aware of the full scope.
In the ideal environment, a developer would have a dedicated tester who would write and maintain tests, as well as validate that the code was functionally correct and met the business requirements.
In the real world, lots of developers are basically lone wolves with limited resources and time and the best way to have solid, bug-free code is to understand the business requirements and then make sure that when writing the code, you make no mistakes. :-)
Not sure about the "best" way, that's probably quite a loaded question...
One way is to use the Web Tests in the Test edition of Visual Studio, see MSDN documentation.
Also here's a simple tutorial.
What specifically are you testing for? Cross browser compliance? Performance? Usability? That's a pretty broad question - can you define it a little more?
In terms of User Acceptance? Bug hunting? Load testing?
For the first one, get other people to use it and comment on it.
For the second one you should use your test plans and test cases that you wrote beforehand to test the UI, in terms of data validation (server-side as well as javascript), range checking and all that stuff. I believe there are tools that simulate clicks as well that you could use.
For the third, try JMeter.
As for testing the engine behind the website, you can bypass the web interface and write test classes that call the engine directly (if it isn't coded directly into the ASP) to test its functions. I would call this a different task to testing the UI however.
AspUnit which can be found on SourceForge.net. However the project is no longer actively developed but it will work on .Net 1.1 and 2.0.
Setup a room with several terminals
running your application
Prepare a list of tasks to be
completed
Bring in volunteers to run through
the tasks
Monitor the actions of the
volunteers either through taping or
a one way mirror
Rinse and Repeat!
I vote for Test Manager in Visual Studio 2010 and then generate "Coded UI tests" for it!
Very easy to create assertions
Very nice code (Readable!)
Easy and maintainable, because the code is easy to read and you can change the way how controls are found on the page
I did a quick comparison or WatiN, Selenium and Test Manager VS2010

Resources