[ 
https://issues.apache.org/jira/browse/DAFFODIL-2958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17903006#comment-17903006
 ] 

Steve Lawrence commented on DAFFODIL-2958:
------------------------------------------

I've attached [^TestSimple.scala], which describes a possible approach for 
running tests which I think simplifies things quite a bit. There are more 
details in the comments of the file, but the high level idea is we have a new 
library (something like daffodil-tdml-junit) that contains a couple traits that 
can be mixed into JUnit classes and remove most of the boilerplate. With the 
changes, a test class would be simplfied to something like this:
{code:scala}
import org.junit.Test

object TestFoo extends DaffodilTdmlSuite {
  val tdmlResource = "/resource/path/to/tests.tdml"
}

class TestFoo extends DaffodilTdmlTests {
  val tdmlSuite = TestFoo

  @Test def test_1(): Unit = test
  @Test def test_2(): Unit = test
  @Test def test_3(): Unit = test
}
{code}
Note that all the Runner creation, @AfterClass cleanup, and logic to run a test 
based on the test name is done all behind the scenes.

This isn't fully fleshed out, it still needs a way to provide additional 
parameters to the Runner factory, and maybe additional enhancements, but I 
think the general concept seems like a bit improvement.

> TDML Runner needs feature to run test using method name as test name
> --------------------------------------------------------------------
>
>                 Key: DAFFODIL-2958
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2958
>             Project: Daffodil
>          Issue Type: Improvement
>          Components: TDML Runner
>    Affects Versions: 3.9.0
>            Reporter: Mike Beckerle
>            Assignee: Mike Beckerle
>            Priority: Major
>         Attachments: TestSimple.scala
>
>
> To avoid all the redundant typing in the test-driver scala files, we need a 
> small feature which uses lihaoyi's sourcecode library to grab the method name.
> This can be used to turn this:
> ```
> @Test def someTestName(): Unit = runner.runOneTest("someTestName")
> ```
> into this:
> ```
> @Test def someTestName(): Unit = runner()
> ```
> which is easier to write and maintain, while maintaining the ability to run a 
> single test via normal right-click in the IDE. 
>  
>  
> W



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to