Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:19:52+00:00 2026-06-12T23:19:52+00:00

My current unit tests are using QUnit and they are executed as described on

  • 0

My current unit tests are using QUnit and they are executed as described on the QUnit website. Basically all my tests are compiled to a tests.js and this is included in the index.html:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>QUnit Example</title>
  <link rel="stylesheet" href="/resources/qunit.css">
</head>
<body>
  <div id="qunit"></div>
  <script src="qunit.js"></script>
  <script src="tests.js"></script>
</body>
</html>

So my question is, how can I use my existing unit tests inside Casper.js?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:19:53+00:00Added an answer on June 12, 2026 at 11:19 pm

    First inject QUnit, and presumably your tests into your website, just like you would jQuery (do this in the casper.start function). These files have to be absolutely located on your local machine to work.

    casper.page.injectJs('/path/to/qunit.js');
    casper.page.injectJs('/path/to/tests.js');
    

    You need to use the evaluate function

    casper.evaluate(function() {
        // this code is run in the context of your website
        doTests();
    });
    

    to execute your tests.

    You could write a function to return your test results and write them to the command line. Or, for the lazier among us, you could grab a screenshot with

    casper.capture('testResults.png');
    

    after the evaluate.

    I haven’t tested this particular method, but I’ve been working with CasperJS recently and believe it to be a sound path towards what you’re looking to accomplish.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error when running some unit tests (using the Test::Unit module
I have some unit tests that expects the 'current time' to be different than
I am writing some unit tests in Visual Studio 2010. I can run all
I have unit tests set up for my iPhone project built using the Google
I'm trying to implement unit tests in my current project. After that I'll start
I'm trying to start using Unit Testing on my current project in Visual Studio
I'm using dotCover to analyze code coverage of my unit tests, and I'm getting
My current project uses NUnit for unit tests and to drive UATs written with
I'm writing a (ever larger) set of unit tests using Coffeescript and node.js. I
My current position is this: if I thoroughly test my ASP.NET applications using web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.