Naming convention while writing selenium Test case..

2,762 views
Skip to first unread message

smriti

unread,
Jul 31, 2012, 2:51:00 AM7/31/12
to seleniu...@googlegroups.com

I know it is not very much related to selenium. But I know this the only platform where I get juggernaut. :)

I am converting the manual testing cases into automation suite..

If my test case id in manual test case is ABC_001. And I am automating the same test case. I am thinking to  write the class name as ABC_001.java so that it can be traceable and we can always map manual test case with automated classes.

Or Should I write the class name as the functionality testing like Logintest.java

 Please suggest?

--Smriti..

 

Greg

unread,
Jul 31, 2012, 4:13:42 AM7/31/12
to seleniu...@googlegroups.com
Yeah it would probably be preferable to stick with the "LoginTest.java" naming standard. ABC_001 is too strict and pretty much excludes you from adding other tests into the same class in the future. So if you wanted to make more tests, then you'd have to make more classes, and then update your framework to run those new tests, whereas if you had just a few class names with multiple test methods embedded in them its much easier to maintain. If you ever wanted to add a new test to LoginTests, you'd just add a new test method and go from there.

I don't know which framework you're using, but if you're coding in java I'd highly recommend TestNG, because alot of your questions on this would probably be better answered by looking into existing test frameworks and figuring out how they work for yourself. You can check out TestNG here: http://testng.org/doc/index.html.

Greg

smriti

unread,
Jul 31, 2012, 4:41:34 AM7/31/12
to seleniu...@googlegroups.com

Yes Greg -- I am using TestNg only. And I am using all the features of it like parameter/dataprovider/groups/exceptions/reporting/annotations etc. so TestNG is helping me  a lot to identifying me the test case as groups like regressions /smoke/sanity,

 

Thanks for your suggestion, And traceability I will ass one more Colum in my excel sheet(db for test data) as T.M.. And there  I will map the manual test case id to automation test cases.

Oscar Rieken

unread,
Jul 31, 2012, 9:56:27 AM7/31/12
to seleniu...@googlegroups.com
I would probably write the test names as the behavior they are trying to verify and the class name based on the area of the application that those examples are being performed on



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/iKq77KB1fjEJ.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

eric aldinger

unread,
Jul 31, 2012, 1:36:39 PM7/31/12
to seleniu...@googlegroups.com
I agree with everyone else, the class and method names should tie to the functionality they attempt to provide/test. I then tie the test methods to the test case(s) they exercise, in the test case management tool I am using for metric analysis (Test Complete, MS Test Manager, Rational). I am not a Java guy, but I would look into tying this together in Maven as part of a continuous integration test/build process. The only issue I have had is when I wanted to run more than one test to meet a given requirement. I would just break the test cases out to a finer grain in that case.


On Monday, July 30, 2012 11:51:00 PM UTC-7, smriti wrote:

Darrell Grainger

unread,
Jul 31, 2012, 1:58:21 PM7/31/12
to seleniu...@googlegroups.com
Is there a problem which needs to be solved? Is the documentation for the manual test cases sufficient? Or would you like more information and better organization?

You can mirror the existing documentation if you are happy with it. If you want to have your automated test cases be more descriptive but still cross-reference to the old manual test case documentation then you can put the manual test case information in a comment. When I used an IDE it usually has a way of setting up templates. For example, in Eclipse I can go to Preferences, expand Java->Code Style->Code Templates and set the templates. I can also add templates. So now if I go New->JUnit Test Case it will create a class with the appropriate comments to fill in. I would then fill in the comments for things like @TestCase ABC_001.

This way I can always search for a manual test case id if needed. I can also write something to parse the document and generate a "manual test case ABC_001 is automated test case Logintest" table.
Reply all
Reply to author
Forward
0 new messages