Permalink
Browse files

Added red/green status caching in memory.

  • Loading branch information...
1 parent 9815d92 commit 4f763060b102728dfccb5e9341790b46a2fc2a71 John Goodsen committed Nov 27, 2008
View
6 TODO
@@ -6,17 +6,17 @@ KNOWN BUGS
ROADMAP / UPCOMING FEATURES
----------------
+* IN PROGRESS - Graphical commander panel to run and show the red/green
+* IN PROGRESS - better graphical feedback on a test run
* Show all tests next to the current test for faster navigation.
* Create a demo/home site at radsoft.com where people can play with this plugin
* Add some screen shots to the home site
-* Graphical commander panel to run and show the red/green
* Run all tests or a selected set of tests at once
* Click on a stack trace in the results and navigate to textmate
* Extract user configurable parameters into a ./config file
* Integrate some relevant 3rd party agile articles/blogs on story tests and cucumber using a feed from radsoft.com (user definable).
-* better graphical feedback on a test run
* structured editing of a cucumber test
-* subversion and git integration for auto-commit of story test updates
+* subversion and git integzration for auto-commit of story test updates
3rd PARTY INTEGRATION PLANS
---------------------------
View
@@ -15,6 +15,18 @@ class RcumberResults < Array
attr_accessor :path, :filename, :raw_content, :name, :preamble, :last_results
+ VALID_STATES = [nil, :passing, :failing, :pending]
+ def state
+ @the_state ||= Rails.cache.read("rcumber/#{uid}/state")
+ @the_state
+ end
+
+ def state=(x)
+ @the_state = x
+ Rails.cache.write("rcumber/#{uid}/state", x.to_s)
+ end
+
+
# For now, the UID is the basename w/o extension of the file: e.g. "../foo.feature" has uid =>"foo"
# TODO: FIXME: This has the limitation that you need unique cucumber filenames down the entire directory tree...
attr_reader :uid
@@ -37,8 +49,16 @@ def to_s
def run
self.last_results = RcumberResults.new(`cucumber #{@path}`.to_a)
+ self.state = :passing
+ Rails.cache.write("rcumber/#{uid}/state", self.state.to_s)
+ self.state = self.parse_test_results
end
+ def parse_test_results
+ return :failing if self.last_results.to_s =~/(\d+) steps failed/
+ return :pending if self.last_results.to_s =~/(\d) (steps|scenarios) pending/
+ end
+
def save
File.open(@path, 'w') {|f| f.write(@raw_content) }
end
View
@@ -187,3 +187,23 @@ WARNING: You're using the Ruby-based MySQL library that ships with Rails. This l
SQL (0.000336) ROLLBACK
SQL (0.000098) BEGIN
SQL (0.000114) ROLLBACK
+WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql).
+ SQL (0.000123) SET SQL_AUTO_IS_NULL=0
+ SQL (0.000096) BEGIN
+ SQL (0.000114) ROLLBACK
+ SQL (0.000127) BEGIN
+ SQL (0.000099) ROLLBACK
+ SQL (0.000121) BEGIN
+ SQL (0.000098) ROLLBACK
+ SQL (0.000108) BEGIN
+ SQL (0.000094) ROLLBACK
+ SQL (0.000091) BEGIN
+ SQL (0.000092) ROLLBACK
+ SQL (0.000090) BEGIN
+ SQL (0.000096) ROLLBACK
+ SQL (0.000076) BEGIN
+ SQL (0.000091) ROLLBACK
+ SQL (0.000197) BEGIN
+ SQL (0.000102) ROLLBACK
+ SQL (0.000134) BEGIN
+ SQL (0.000100) ROLLBACK
@@ -31,7 +31,7 @@
<%= yield %>
</div>
</div>
- <div id="ft">rcumber, &copy; 2008, under MIT license, John Goodsen, RADSoft.</div>
+ <div id="ft"></div>
</div>
</body>
</html>
@@ -24,7 +24,33 @@ line-height:1.5em;
margin:1em 0pt;
padding:0.5em;
}
-
+
+
+table.cucumbers {
+ margin-top: 20px;
+ border: 1px solid #999;
+ background: #eee;
+}
+
+table.cucumbers thead{
+ background: lightblue;
+}
+
+span#state {
+ border: 1px solid #999;
+ padding: 2px;
+ font-size: .7em;
+}
+.passing {
+ background: lightgreen;
+}
+.pending {
+ background: lightyellow;
+}
+.failing {
+ background: red;
+}
+
ul.rcumber_content {
min-height: 300px;
background: #eee;
@@ -3,21 +3,29 @@
<h1><img src="/images/rcumber.gif"/>Rcumber</h1>
<h3>Here's all your Cukes!</h3>
<%= link_to 'create a new cucumber', new_rcumber_path + demo_parameters %>
-<ul id="cucumber_tests">
<% if @rcumbers.empty? %>
<p>You don't have any Cucumber tests in the ./feature directory of your project. <br/>
Either create some, or you can look at these <%= link_to 'demo cucumber tests', rcumbers_path + "?demos=true" %>
</p>
<% else %>
- <% @rcumbers.each do |rcumber| %>
- <%= content_tag :li,
- content_tag(
- :a, rcumber.name,
- :href => rcumber_path(rcumber.uid) + demo_parameters
- ),
- :class => 'cucumber_test'
- %>
- <% end %>
+ <table class="cucumbers">
+ <thead>
+ <tr><td>Name</td><td>State</td><td>Actions</td></tr>
+ </thead>
+ <tbody>
+ <% @rcumbers.each do |rcumber| %>
+ <tr>
+ <td><%= rcumber.name %></td>
+ <%# rcumber.state = :passing %>
+ <td class="<%= rcumber.state.to_s %>"><%= rcumber.state.to_s %></td>
+ <td>
+ <%= link_to 'Run', rcumber_run_path(rcumber.uid) + demo_parameters %>
+ <%= link_to 'View', rcumber_path(rcumber.uid) + demo_parameters %>
+ </td>
+ </tr>
+ <% end %>
+ <tbody>
<% end %>
-</ul>
+
+
</div>
@@ -7,7 +7,9 @@ var myTabs = new YAHOO.widget.TabView("demo");
<div id="demo" class="yui-navset">
<ul class="yui-nav">
<li class="<%= @rcumber.last_results.nil? ? 'selected' : '' %>">
- <a href="#tab1"><em>Cucumber Test</em></a>
+ <a href="#tab1"><em>
+ Cucumber Test <span id="state" class="<%= @rcumber.state.to_s %>"><%= @rcumber.state.to_s %></span>
+ </em></a>
</li>
<% unless @rcumber.last_results.nil? %>
<li class="<%= @rcumber.last_results ? 'selected' : '' %>">

0 comments on commit 4f76306

Please sign in to comment.