I am not able to commit a Test Class in a User Story.

You may have committed an Apex Class in a User Story and later you need to add the Apex Test Class in the same User Story in order to calculate the Test Coverage.

If you Commit the Test Class alone without making any changes, this will result in a No Changes commit and the Test Class won't be added to the User Story. This is the expected behaviour. Based on the architecture of Copado, committing the class alone will produce a No Changes commit.

If you run into the situation where a Test Class must be added to the User Story, the Class is already added to the User Story and you do not want to change anything in the test class, you have several options:

1. Create a new User Story and commit both class and test class again.

2. Delete the feature branch in Git and commit again the class and test class at the same time.

3. Delete the test class file in the feature branch and commit the test class again in the same user story. This will recreate the test class in the feature branch which is consider a change and the commit will be successful. 

Any workaround where you manage to commit the class and test class making changes in the feature branch, will work. If you make any change in the test class, this one will result in a successful commit even if it's committed alone.

Users on Copado v11 or higher can use the feature Add Test Classes to add test classes to the user story even if the classes have not been modified. The classes added with this feature will not be committed and/or deployed.

How did we do?