HaroonBadsha / js-test-driver

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

Running --tests TestCase.testName Runs Similarly Named Tests #358

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Create two tests with similar names (in my case, testCreateSubObjectPattern 
and testCreateSubObjectPatternWithConstraint)

2. Try running JSTD with --tests YourTestCaseName.TheFirstTestsName (in my 
case, --tests SearchModelJSONTest.testCreateSubObjectPattern)

What is the expected output? What do you see instead?

According to the documentation:
"* TestCaseName.testName run only the specified test, useful when debugging a 
single test."

However (contrary to the documentation) both tests run.

What version of the product are you using? On what operating system?
1.3.4.b on (Mint/Ubuntu) Linux.

Original issue reported on code.google.com by jer...@syapse.com on 9 Apr 2012 at 5:18

GoogleCodeExporter commented 8 years ago
Out of date docs. Updated:

* `all` special keyword to run all of the tests.
  * `TestCaseName` run all tests for that test case.
  * `TestCaseName#testName` run only the specified test, useful when debugging a single test. See DebuggingWithJsTestDriver.
  * Additionally, it accepts regular expressions for any part of the string. '#' is reserved, and unexpected results may happen when using # in a test name.

Original comment by corbinrs...@gmail.com on 9 Apr 2012 at 5:33

GoogleCodeExporter commented 8 years ago
That was fast!  Thanks.

Original comment by jer...@syapse.com on 9 Apr 2012 at 5:37

GoogleCodeExporter commented 8 years ago
Shoot, I spoke too soon; even with the updated syntax I have the same problem.  
When I run JSTD 1.3.4.b on Firefox/Linux with the following tests arg:

--tests SearchModelJSONTest#testCreateSubObjectPattern

JSTD runs both my "testCreateSubObjectPattern" test and my 
"testCreateSubObjectPatternWithConstraint" (which is also in my 
SearchModelJSONTest test case).

Original comment by jer...@syapse.com on 9 Apr 2012 at 5:44

GoogleCodeExporter commented 8 years ago
It's a  js regex, so usual rules apply. :)

Try SearchModelJSONTest#testCreateSubObjectPattern$

Original comment by corbinrs...@gmail.com on 9 Apr 2012 at 5:47

GoogleCodeExporter commented 8 years ago
Dunno if this helps, but here's a snippet of a run with runnerMode=DEBUG:

Apr 9, 2012 10:45:54 AM com.google.jstestdriver.CommandTask run
FINE: Starting 
{"command":"runTests","parameters":["[\"SearchModelJSONTest#testCreateSubObjectP
attern\"]","false","1"]} for 1333987937145
.FApr 9, 2012 10:45:58 AM com.google.jstestdriver.CommandTask run
FINE: finished 
{"command":"runTests","parameters":["[\"SearchModelJSONTest#testCreateSubObjectP
attern\"]","false","1"]} for 1333987937145 with TEST_RESULT
Apr 9, 2012 10:45:58 AM com.google.jstestdriver.CommandTask run
FINE: finished 
{"command":"runTests","parameters":["[\"SearchModelJSONTest#testCreateSubObjectP
attern\"]","false","1"]} for 1333987937145
Apr 9, 2012 10:45:58 AM com.google.jstestdriver.browser.BrowserActionRunner call
FINE: stopping session on 1333987937145 with id 
05c28962-1281-41de-a522-4afe47fa7a98
Apr 9, 2012 10:45:58 AM 
com.google.jstestdriver.browser.BrowserActionExecutorAction run
FINE: Finished BrowserActions [com.google.jstestdriver.RunTestsAction@315b0333].

Total 2 tests (Passed: 1; Fails: 1; Errors: 0) (3646.00 ms)

Let me know if a full log would be helpful.

Original comment by jer...@syapse.com on 9 Apr 2012 at 5:48

GoogleCodeExporter commented 8 years ago
Ahhh, sorry posted right after you.  Adding a $ to the end did fix things and 
make only one test run.

Original comment by jer...@syapse.com on 9 Apr 2012 at 5:48

GoogleCodeExporter commented 8 years ago
That being said, it's possible that not everyone who uses JSTD will figure out 
that they have to use a regex (with a $), even if you put it in the docs 
(although I guess it depends on how prominently you mention it, and whether or 
not its included in --help).

Just a thought: it might be nice to have either a --test argument (that one 
could use in place of --tests when they only want to run a specific test by 
name), or a --named-tests-only argument that could be used in conjunction with 
--tests to "turn of" regex matching.  Certainly not an important feature, but 
it might be nice (especially for JSTD noobs) since wanting to run just one test 
is pretty common.

Original comment by jer...@syapse.com on 9 Apr 2012 at 5:57