View unanswered posts | View active topics



Reply to topic  [ 5 posts ] 
Can't get started with AsUnit 
Author Message
Member

Joined: Fri Sep 26, 2014 2:36 pm
Posts: 7
Reply with quote
I'm trying to write my first test but these errors happen. And they happen on multiple computer.

Main:
Code:
3:   import asunit.textui.TestRunner;

                ...

      public function Main() {
         testAll();
      }
      
      public function testAll():void {
20:         var testRunner:TestRunner = new TestRunner();
         addChild(testRunner);
22:         testRunner.start(AllTests, null, TestRunner.SHOW_TRACE);
      }


Main.as(3): col: 22 Error: Definition asunit.textui:TestRunner could not be found.
Main.as(20): col: 19 Error: Type was not found or was not a compile-time constant: TestRunner.
Main.as(20): col: 36 Error: Call to a possibly undefined method TestRunner.
Main.as(22): col: 21 Error: Access of undefined property AllTests.
Main.as(22): col: 37 Error: Access of undefined property TestRunner.

AllTests:
Code:
   public class AllTest extends TestSuite {
      
      public function AllTest() {
         super();
         addTest(new FirstTest("TestTest"));
      }
      
   }


FirstTest:
Code:
   public class FirstTest extends TestCase
   {
      
      public function FirstTest(testMethod:String) {
         super(testMethod);
      }
      
      public function TestTest():void {
         var s:String = "string";
         assertEquals(s, "string");
      }
      
   }


Wed May 20, 2015 4:09 am
Profile
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 12172
Location: London
Reply with quote
How are you compiling?
The error indicates that asunit support classes aren't in the classpath.


Thu May 21, 2015 3:45 pm
Profile WWW
Member

Joined: Fri Sep 26, 2014 2:36 pm
Posts: 7
Reply with quote
Well I use Flex SDK 4.6


Sat May 23, 2015 8:09 am
Profile
Member

Joined: Fri Sep 26, 2014 2:36 pm
Posts: 7
Reply with quote
I rewrote the test and the only one error left: "The definition of base class TestRunner was not found."

Code:
      public function Main() {
         var testRunner:JTestRunner = new JTestRunner();
         addChild(testRunner);
      }


Code:
   import asunit.textui.TestRunner;
   
   public class JTestRunner extends TestRunner // <----- HERE
   {
      
      public function JTestRunner() {
         start(JTestSuite, null, TestRunner.SHOW_TRACE);
      }
      
   }


Code:
   import asunit.framework.TestSuite;

   public class JTestSuite extends TestSuite {
      
      public function JTestSuite() {
         super();
         addTest(new FirstTest("TestString"));
      }
      
   }



Code:
   import asunit.framework.TestCase;

   public class FirstTest extends TestCase
   {
      
      public function FirstTest(testMethod:String) {
         super(testMethod);
      }
      
      public function TestString():void {
         var s:String = "string";
         assertEquals(s, "string");
      }
      
   }


Sat May 23, 2015 9:05 am
Profile
Member

Joined: Fri Sep 26, 2014 2:36 pm
Posts: 7
Reply with quote
Nevermind. I solved the problem. I installed the wrong folder of AsUnit :D


Tue May 26, 2015 5:17 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.