Re-use scenarios on multiple pages - bdd

I am new to Specflow and need a way to reuse scenarios in multiple feature files.
I have a web application consisting of multiple pages that each share a many items such as footer content. Say my footer contains 3 links:
Help | Feedback | FAQ
I have a scenario to test the "Help" link functionality:
Scenario: Help link
Given I am on page1
When I click on the link containing text "Help"
Then I see the help popup
As the "Given" statement specifies which page to open, the scenario is tied to that page. In order to test the same help link functionality on page2, page3, page4, etc., I would need to:
1) Copy the scenario into another feature file
2) Change the given statement to reference the correct page
3) Repeat for all pages containing the help link!
This seems like an awful lot of duplication and there must be a better way to do this.

You can use a Scenario Outline, which is basically a data driven test:
Scenario Outline: Help link
Given I am on <Page>
When I click on the link containing text "Help"
Then I see the help popup
Examples:
| Page |
| Home |
| Contact Us |
| About Us |

You can't test everything when you work at this level. In fact you can only test a fraction of whats possible. So what you have to do is think about what benefit you get for testing the footer on each other page, and see if this is worth the cost of
Writing the tests
Running the tests
Secondly you don't need to repeat all the tests for each page. If the links work on one page then they will work on every other page, so you could test the links once, and then subsequently check that the footer appears on other pages e.g.
Feature: Footer checks
Scenario: Footer appears on pages
Given a selection of pages
When each page is visited
Then each page should have the footer
and have your selection of pages be a random small sample from all the pages.

Related

Why data is different in Next Page Flow Report and PageView report?

This is related to Site-Catalyst reporting.
I was looking into 'Next Page Flow Report' for a particular page. The report says, for a particular time duration, the total path views were 4500. But when I looked into 'pageViews' report of the same page, it says, the pageViews of that page for the same duration was 5,000. Ideally, the pageViews and path views should match, since anyone who landed on that page (which is pageview) must either exit or should navigate to any next page (which comes in next page flow report). Not sure, why this difference is coming then.
Does anyone has any idea about this ? Please help.
Thanks,
Adwait
For example, let's say you have 3 pages, and lets say that individually (looking at pages report), each page had 10 page views:
PageA : 10 page views
PageB : 10 page views
PageC : 10 page views
In your pages report, you should see it just like that. But page views within a pathing report are shown in relation to paths, not standalone page views. So for example, one path could be:
PageA (3 page views) > PageB (4 page views) > (exited site)
This just shows how many people took the same path throughout your site, where they diverged, etc..think of it like a choose-your-own-adventure book, where at each point of the story, the reader can choose which way the story goes, so that overall, there are different permutations of the story. A website works in much the same way. Visitors can start off on virtually any page accessible on your site (though usually the homepage or landing pages are the most common), and from there, they navigate to wherever else on your site.
So, if you were to add up the page views for PageA for all the paths, it should match what's in the base pages report, but if you are looking at page views for an individual path, it's not going to add up, because it's just page views for that page that happened in that one path (well, it's theoretically possible for them to match, e.g. if there's only one path, but that's highly unlikely to actually happen).
Path Views will always report Pure Page Views (yes, I call it Pure).
What does this mean? Well, it simply means that the Path Views for a Page is equal to the Total Page Views less the Reloads of that Page for a specific period.
Therefore, if your Path Views are 4500, and Page Views are 5000, then this means that your page was reloaded 500 times.

how do I force a page break in Rave Reports, Delphi 7?

I am new to Rave and I'm having a ridiculous amount of difficulty forcing page breaks between sections of my report. It's a master-detail report, with various types of detail sections (master = patient; detail 1 = visit history; detail 2 = medications etc.). I've got the detail sections working ok but need to: a) force a page header to carry over on every page and b) force each detail section to start on a new page. In other words, I want every page of the report to include a header with the patient name, ID etc., and I want each type of data (visits, meds, etc.) to appear as its own section.
I've tried the different Band styles and checkboxes for having the bands appear on every new page, etc., but I can't get a header or a page break for the life of me.
Can anyone provide the settings I should use for the page header band and the bands that should begin a new page with each section? Many thanks!
Clicking "New Page (P)" in Band Style Editor should force it to be printed on each page. If not, maybe verify that the Header band style (Group/Body etc) has the ControllerBand set to the Detail databand of your DataView.

RAILS: Tracking content with /#foo in the address bar

Just like in Gmail, I want to create a div which when loaded with ajax would output a #foo in the address bar to track what content would be loaded.
If you go to https://mail.google.com/mail/?shva=1#sent gmail, if signed in, will take you straight to your sent box.
I want to do the same. For example. I have a div that loads a list of recipes. Once a recipe on the list has been clicked content gets loaded from db in the same div and the address bar would say http://site.com/#recipe-permalink. If this link gets passed to a friend and the friend goes to http://site.com/#recipe-permalink the div would load appropriate content with that recipe.
Also is there a way to control more than one div? For example if url is http://site.com/#recipe-permalink#blue app would load recipe in one div and appropriate content in another div for #blue (what ever it may be).
Is there a way to make cells or apotomo have this functionality?
Are there any SEO concerns with doing this as well? Would the crawlers be able to pick up content through #foo links?
Probably not a full answer to your question but I believe this episode of railscasts would be interesting to you.
http://railscasts.com/episodes/246-ajax-history-state

How can I remove body from a Page in OrchardCMS?

I currently have 2 page types in my Orchard CMS setup. One is for the front page, one for a detail page. On the front page, I have removed the body from being displayed, so that it just shows 2 HTML widgets.
Is there a way so that when someone edits this page, they don't get a body section?
A placement file might also do the trick: placement also works for the admin ui... That could enable you to make it show or not without requiring two different content types.
You can remove the Body Part from the page content type you use for the front page. This way people who edit this page won't see the editor for body content and the body won't be rendered at all.
HTH

Multiple layouts vs css trickery vs partials in a rails app for dynamic page layout

I was wondering if anyone could comment on which way is better and WHY?
Here is a simplified version of what I have ( in HAML):
#header
#root
#content
= yield
#sidebar
= context_navigation
#footer
The problem:
I want #sidebar to display on some pages to show context menu, such as on the account page to show links to profile, password, order history. On the product page show links to product specifications, description, "send link", etc. But not on other pages - such as on the home page I need to use the whole width of #root for #content to show news or featured items.
Solution & Question:
I have several ideas on how to implement it, but I was looking for some input at to which one you think is better and please explain WHY? The main objective is maintainability of code.
Here are some ideas:
CSS \ SCSS trickery - make the sidebar a collapsible div if there context navigation is empty
Use an else/if to load different partials depending on which part of the site I'm in.
Create a separate layout (seems like an overkill - as I understand layouts are to be used mostly for different media such as screen vs. print vs. pdf vs. mobile - etc)
Any other ideas?
Thank you,
Nick
You could use nested layouts to get this working:
http://guides.rubyonrails.org/layouts_and_rendering.html#using-nested-layouts
Different views might serve you well... you may need to rethink your controller also to make them more use case specific. Going along this route will make you app more dynamic, increase cohesion amongst all of the components and allow for greater extensibility.

Resources