LiTiang / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Can not open test by double-clicking in JsTestDriver view #337

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Write and run test case:
TestCase("class.js", {
  testMethods: function() {
    assertFunction(Class.Methods.extend);
    assertFunction(Class.Methods.include);
    assertFunction(Class.create);
  }
});
2. After execution double-click on "testMethods" line in JsTestDriver view

What is the expected output?
File with this test case and method should be opened.

What do you see instead?
Message "Can not open the test."

What version of the product are you using? On what operating system?
JsTestDriver plugin for Eclipse, version 1.3.4.e.

Please provide any additional information below.
Method createPattern() in class TestCaseFinder creates too strict pattern to 
find test method:
    return Pattern.compile("[;\\s]" + testCaseName + "\\.prototype\\." + testName + "[\\s=].*");

It cannot find tests like
TestCase("testCaseName", {
  testName: function() {
    // code
  }
});

Original issue reported on code.google.com by vkhomyackov on 15 Feb 2012 at 4:12

GoogleCodeExporter commented 9 years ago
Also test defined as
testCaseName.prototype['testName'] = function () {};
will not be found

Original comment by vkhomyackov on 16 Feb 2012 at 9:39

GoogleCodeExporter commented 9 years ago
Attached modified source files and patch

Original comment by vkhomyackov on 16 Feb 2012 at 10:22

Attachments:

GoogleCodeExporter commented 9 years ago
Tested in Aptana 3.0.8

Original comment by vkhomyackov on 16 Feb 2012 at 10:22

GoogleCodeExporter commented 9 years ago
Hi, thanks for the patch!

To merge it, I'll you to fill out either a ICLA
(http://code.google.com/legal/individual-cla-v1.0.html) or a CLA
(http://code.google.com/legal/corporate-cla-v1.0.html) before they can
be merged in.

Original comment by corbinrs...@gmail.com on 13 Mar 2012 at 4:09

GoogleCodeExporter commented 9 years ago
Signed ICLA.

P.S. What do you think about untestability of these classes? Methods are 
private or use specific classes like IFile, TextSearchMatchAccess etc.

Original comment by vkhomyackov on 13 Mar 2012 at 5:06

GoogleCodeExporter commented 9 years ago
They were from an earlier contributor. I expect I'll be refactoring for a bit.

Original comment by corbinrs...@gmail.com on 13 Mar 2012 at 6:07

GoogleCodeExporter commented 9 years ago
Also I've updated regexp in TestCaseNameFinder and corresponding unit test

Original comment by vkhomyackov on 14 Mar 2012 at 8:16

Attachments:

GoogleCodeExporter commented 9 years ago
Same as patches

Original comment by vkhomyackov on 14 Mar 2012 at 8:16

Attachments:

GoogleCodeExporter commented 9 years ago
I'm getting the same error using AngularJS' Jasmine tests. I will try the 
patches in a bit to see if they work for Jasmine-style tests as well.

Original comment by leze.maj...@gmail.com on 2 Jul 2012 at 11:35