diff --git tests/views_groupby.test tests/views_groupby.test
new file mode 100644
index 0000000..be38ea9
--- /dev/null
+++ tests/views_groupby.test
@@ -0,0 +1,106 @@
+<?php
+// $Id$
+
+module_load_include('test', 'views', 'tests/views_query');
+
+class ViewsQueryGroupByTest extends ViewsSqlTest {
+  public static function getInfo() {
+    return array(
+      'name' => 'Tests groupby feature of views3',
+      'desc' => 'tests aggregate functionality of views3, for example count',
+      'group' => 'Views',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp('views', 'views_test');
+  }
+
+  /**
+   * Test aggregatate count feature.
+   */
+  public function testAggregateCount() {
+    // Create 2 nodes of type1 and 3 nodes of type2
+    $type1 = $this->drupalCreateContentType();
+    $type2 = $this->drupalCreateContentType();
+    debug($type1);
+    debug($type2);
+
+    $node_1 = array(
+      'type' => $type1->type,
+    );
+    $this->drupalCreateNode($node_1);
+    $this->drupalCreateNode($node_1);
+    $node_2 = array(
+      'type' => $type2->type,
+    );
+    $this->drupalCreateNode($node_2);
+    $this->drupalCreateNode($node_2);
+    $this->drupalCreateNode($node_2);
+
+    $view = $this->viewsAggregateCountView();
+    $view->set_display('default');
+    $output = $view->execute_display();
+
+    foreach ($view->result as $item) {
+      $types[$item->node_type] = $item->count;
+    }
+
+    $this->assertEqual($types[$type1->type], 2);
+    $this->assertEqual($types[$type2->type], 3);
+
+    // order by the other way
+    $display = (array) $view->display['default']->handler;
+
+    debug(array_keys($display));
+  }
+
+  //public function testAggregateSum() {
+  //}
+
+  public function viewsAggregateCountView() {
+    $view = new view;
+    $view->name = 'views_test_aggregate_count';
+    $view->description = '';
+    $view->tag = '';
+    $view->view_php = '';
+    $view->base_table = 'node';
+    $view->is_cacheable = FALSE;
+    $view->api_version = 2;
+    $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+
+    /* Display: Defaults */
+    $handler = $view->new_display('default', 'Defaults', 'default');
+    $handler->display->display_options['access']['type'] = 'none';
+    $handler->display->display_options['cache']['type'] = 'none';
+    $handler->display->display_options['exposed_form']['type'] = 'basic';
+    $handler->display->display_options['pager']['type'] = 'some';
+    $handler->display->display_options['style_plugin'] = 'default';
+    $handler->display->display_options['row_plugin'] = 'fields';
+    /* Field: Node: Title */
+    $handler->display->display_options['fields']['title']['id'] = 'title';
+    $handler->display->display_options['fields']['title']['table'] = 'node';
+    $handler->display->display_options['fields']['title']['field'] = 'title';
+    $handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
+    $handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
+    $handler->display->display_options['fields']['title']['alter']['trim'] = 0;
+    $handler->display->display_options['fields']['title']['alter']['word_boundary'] = 1;
+    $handler->display->display_options['fields']['title']['alter']['ellipsis'] = 1;
+    $handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
+    $handler->display->display_options['fields']['title']['alter']['html'] = 0;
+    $handler->display->display_options['fields']['title']['hide_empty'] = 0;
+    $handler->display->display_options['fields']['title']['empty_zero'] = 0;
+    $handler->display->display_options['fields']['title']['link_to_node'] = 0;
+    /* Argument: Node: Type */
+    $handler->display->display_options['arguments']['type']['id'] = 'type';
+    $handler->display->display_options['arguments']['type']['table'] = 'node';
+    $handler->display->display_options['arguments']['type']['field'] = 'type';
+    $handler->display->display_options['arguments']['type']['default_action'] = 'summary asc';
+    $handler->display->display_options['arguments']['type']['style_plugin'] = 'default_summary';
+    $handler->display->display_options['arguments']['type']['default_argument_type'] = 'fixed';
+
+    return $view;
+  }
+
+}
+
