csscritic

Lightweight CSS regression testing

  • 所有者: cburgmer/csscritic
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

CSS Critic

What?

One picture might say more than 1000 words:

For background information watch the screencast or if you feel like playing around have a look at the runnable instance. This example project helps you get started with your own setup.

Why?

Your web stack should be fully testable. CSS Critic closes the gap in front end testing and makes HTML & CSS testable - no more broken UI. For example, make it supervise changes to your project's responsive styleguide so you know things are looking good.

How is it different to the other tools out there?

We believe that your UI will change often enough that a lightweight process on managing changes (near instant feedback, anyone?) is more important than a heavy-weight one which could offer tighter control. Also CSS Critic aims at bridging the gap between user experience (UX) people and (UI) developers. You probably won't find any easier way of sharing your UI tests than as the simple web page that CSS Critic basically is. And don't feel put down by the "CSS" bit, you may throw anything at it that can be converted into a simple image.

How to install?

$ npm install csscritic

See node_modules/csscritic/example/RegressionRunner.html for an example on how to take it from there.

How does it work?

CSS Critic checks your current layout constantly against a reference image you have provided in the past. If your layout breaks (or simply changes - CSS Critic can't tell) your tests fail.

Get started:

  1. Create a RegressionRunner.html similar to the one under example/ and put it with your code that is to be tested.

  2. Register your page under test via:

    csscritic.add({
        url: 'SOME_URL',  // link to the test case HTML document
        desc: 'some text' // optionlly, a description of the test case (see API for even more options)
    });
    
  3. Open the RegressionRunner.html in Firefox for the first time and save the resulting image as future reference.

  4. Re-run the RegressionRunner.html and see your test passing. Congratulations.

What do I do if my test fails?

  1. Have a look at the diff image and visually inspect what has changed.

  2. If the change is an unwanted one fix your CSS,

  3. If deliberate accept the change (generating a new reference image).

Developing CSS Critic

For tests install Node.js and run

$ ./go

Build Status

Limitations

  • Currently works in Firefox and Chrome only.
  • Same-origin restrictions apply when sourcing files. All files referenced need to be inside the same directory as the RegressionRunner.html or in ones below.
  • Because of the way the HTML is rendered internally certain limitations apply, see the documentation of the render backend.

For more information see the FAQ and API.

Licensed under MIT. Maintained by @cburgmer. Copyright (c) 2012, 2013 ThoughtWorks, Inc.

主要指标

概览
名称与所有者cburgmer/csscritic
主编程语言JavaScript
编程语言JavaScript (语言数: 3)
平台
许可证
所有者活动
创建于2012-08-23 23:38:05
推送于2023-01-28 16:43:50
最后一次提交2023-01-28 17:43:03
发布数17
最新版本名称2.0.1 (发布于 )
第一版名称0.1.0 (发布于 )
用户参与
星数487
关注者数16
派生数19
提交数700
已启用问题?
问题数78
打开的问题数16
拉请求数16
打开的拉请求数1
关闭的拉请求数10
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?