Forum Discussion

Hellotest's avatar
3 years ago

How to remove or discard changes in one of the test case


I had updated 3 existing test cases and I want to discard changes to one of the test case.

I am not seeing an option to do it Ready API , trying to avoid discard all changes as there is lot of effort in building other two testcases.

Please suggest how to do.


4 Replies

  • richie's avatar
    Community Hero
    Hey Hellotest,

    ReadyAPI and any other tool that doesnt support real version control wont allow you to do what you want. At most you "might" be able to rollback one saved change, but other than that, i cant see how this is achievable unless youre using version control software like git. If you are using git then what youre asking to do is possible, although youd have to do it in git itself (via say GitBash, etc.).

    You gotta remember that to be able to rollback to a previous version or commit, then there must be some capability that snapshots what youre working on.

    If you were using git you could use something like git cherrypick to grab the relevant commits you want or something equivalent.

    Without knowing anything about what youre using it's difficult but in git id do something like the following.

    In your current branch with the 3 updated testcases which you only want 2 of them that have been updated, id delete the testcase that you dont want updated and then checkout to a new branch (via gitbash using 'git checkout -b newbranch name') then within gitbash id add, commit and push the changes (changes are 2 updated testcases and 1 deleted testcase).
    Within the new branch (within gitbash), id then merge the old branch (with the 3 testcases that hadnt been updated) with the new branch (new branch has 2 updated testcases and 1 missing testcase) using 'git pull origin old_branchname' (within gitbash). Your merged branch should then have the 2 updated testcases and the 3rd testcase that wasnt updated....which is what you wanted, right?

    Cheers! Hope this helps!

    • Hellotest's avatar


      I am using Ready API 3.20.1 and using GIT.

      In Ready API GIT panel , I don't see option to do cherry pick or undo any one of the change. There is only Discard all changes.

      Please suggest if I am missing something.


      • richie's avatar
        Community Hero

        yeah Hellotest  - obviously I wasn't clear - I said use GitBash or other Git command line utility to sort what you need.


        I've just had another look at the Git menu (in ReadyAPI v3.20.0 on my work machine) and it's expanded since I last used Git in ReadyAPI.  

        If you click on the project level and right click - the context menu launches and you can see there are a number of options within the Git sub menu.


        Looking at the menu options available you can probably do this mixing some ReadyAPI embedded functionality with a bit of git console (you might be able to do it entirely in ReadyAPI), but I cant advise on that cos I cant replicate to give you the step by step instructions via ReadyAPI.  If you havent got git console installed - you can do it via ReadyAPI (which will certainly help).


        as I say - I can't trial this out on my own machine unfortunately - so I'm gonna give you the instructions to do it via Git Console.


        So - you've got 3 tests and you only want 2 of them with the updated changes - right?


        Within ReadyAPI:


        1.Right click on the project to launch the context menu and select 'Git' >> 'Setup Git Console' (follow the instructions to complete Git console setup)

        2. Within ReadyAPI:- delete the one test - leaving only the 2 tests

        3. Close ReadyAPI (leaving the 2 updated tests not added/committed or pushed yet)

        4.  Launch the Git console and navigate to the folder that contains your local repo and will be pointing to your local branch.  Input the command the following commands in sequence:

           4a.  'git checkout -b newLocalBranchName'   <--- creates a new local branch

           4b.  'git add .'   <--- moves the changes from your working directory to the index/staging area

           4c.  'git commit .'   <--- moves the changes from the index/staging to your HEAD

           4d.  'git push --set-upstream origin newLocalBranchName'   <--- pushes the changes to remote creating a copy of your local branch back up on the remoteServer

           4e.  'git checkout previousBranchName'  <--- here you're switching back to the original branch

           4f.   'git reset --hard'  <--- reverts any changes to the original branch

           4g.  'git clean -fd'  <--- cleans everything up - untracked files and any temp directories

           4h.  'git pull origin newLocalBranchName'  <-- this essentially merges the changes from the new branch (the new updated files) with the previous branch - the previous branch has 3 unchanged tests - the new branch had 2 updated tests and 1 missing test - so you'll be merging the updates to the 2 tests and the deleted test back into your current branch


        I think you can probably do above with a mix of the embedded functionality plus a tiny bit of console - but I cant be sure.